Re: owner field in `struct fs'

Rusty Russell (rusty@linuxcare.com.au)
Wed, 28 Jun 2000 14:30:20 +1000


In message <3958C038.C9CFA2DF@uow.edu.au> you write:
> Rusty Russell wrote:
> > AFAIK his work never went in/was never completed 8( So del_timer_sync
> > doesn't work on self-deleting timers.
>
> His work was a masterpiece. Linus was looking at the timer_exit()
> abomination last week and I sent a smorgasbord of patches which remove
> it. Hoping to see one come back at us soon.

Excellent; I'm extremely grateful for this work...

> But del_timer_sync(), like del_timer() still must not be used on
> self-kfreeing timers. I think a variant could be made to do so quite
> easily (esp. if Linus chooses the right patch).
>
> - grab the timerlist_lock
> - see if any timers are running. If so, unlock and retry.
> - walk the tvecs looking for the timer.

No, delete_self_deleting_timer_sync() would look like:

- grab the timerlist_lock
- detach_timer
- if that succeeds, release lock
- if that failed:
- if timer is running now, release lock, spin until its done
- if timer isn't running, release lock, BUG()

This is required, because if you call `del_timer(&timer)' you *need*
to know (because you have your own spinlocks) that it hasn't run yet,
or is running at the moment. That's because if it's finished running,
you might now be deleting a completely unrelated timer...

Enjoy!
Rusty.

--
Hacking time.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/