On 04/24, David Howells wrote:Of course, del_timer() and del_timer_sync() are different. What I meant the latter buys nothing for cancel_delayed_work() (which in fact could be named try_to_cancel_delayed_work()). Let's look at (2). cancel_delayed_work() (on top of del_timer()) returns 0, and this is correct, we failed to cancel the timer, and we don't know whether work->func() finished, or not. The current code uses del_timer_sync(). It will also return 0. However, it will spin waiting for timer->function() to complete. So we are just wasting CPU. I guess I misunderstood you. Perhaps, you propose a new helper which use try_to_del_timer_sync(), yes? Unless I missed something, this doesn't help. Because the return value == -1 should be treated as 0. We failed to stop the timer, and we can't free dwork. IOW, currently we should do: if (!cancel_delayed_work(dwork)) cancel_work_sync(dwork)); The same if we use del_timer(). If we use try_to_del_timer_sync(), if (cancel_delayed_work(dwork) <= 0) cancel_work_sync(dwork)); (of course, dwork shouldn't re-arm itself). Could you clarify if I misunderstood you again? No, it can't be preempted, it runs in softirq context. Oleg. -
| Andreas Gruenbacher | Re: [AppArmor 39/45] AppArmor: Profile loading and manipulation, pathname matching |
| Alan Cox | Re: [patch 7/8] fdmap v2 - implement sys_socket2 |
| Jens Axboe | Re: regression: CD burning (k3b) went broke |
| Paul E. McKenney | Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures |
git: | |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| David Miller | [GIT]: Networking |
| Alexey Dobriyan | [PATCH 09/33] netns ct: per-netns /proc/net/nf_conntrack, /proc/net/stat/nf_conntr... |
| Gerrit Renker | [PATCH 18/37] dccp: Support for Mandatory options |
