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 <t...@kernel.org>
Cc: Thomas Gleixner <t...@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

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

Reply via email to