Messages in this thread Patch in this message | | | From | Tejun Heo <> | Subject | [PATCH 24/25] debugobjects: don't use [delayed_]work_pending() | Date | Fri, 21 Dec 2012 17:57:14 -0800 |
| |
There's no need to test whether a (delayed) work item in pending before queueing, flushing or cancelling it. Most uses are unnecessary and quite a few of them are buggy.
Remove unnecessary pending tests from debugobjects. While at it, change @sched to bool and move kevent_up() test to later for brevity.
Only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> --- Please let me know how this patch should be routed. I can take it through the workqueue tree if necessary.
Thanks.
lib/debugobjects.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index d11808c..b9dbfdf 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -189,20 +189,19 @@ static void free_obj_work(struct work_struct *work) static void free_object(struct debug_obj *obj) { unsigned long flags; - int sched = 0; + bool sched; raw_spin_lock_irqsave(&pool_lock, flags); /* * schedule work when the pool is filled and the cache is * initialized: */ - if (obj_pool_free > ODEBUG_POOL_SIZE && obj_cache) - sched = keventd_up() && !work_pending(&debug_obj_work); + sched = obj_pool_free > ODEBUG_POOL_SIZE && obj_cache; hlist_add_head(&obj->node, &obj_pool); obj_pool_free++; obj_pool_used--; raw_spin_unlock_irqrestore(&pool_lock, flags); - if (sched) + if (sched && keventd_up()) schedule_work(&debug_obj_work); } -- 1.8.0.2
| |