[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625141539.GA14254@redhat.com>
Date: Tue, 25 Jun 2024 16:15:39 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [RFC PATCH 1/6] task_work: Provide means to check if a work is
queued
On 06/25, Frederic Weisbecker wrote:
>
> --- a/kernel/task_work.c
> +++ b/kernel/task_work.c
> @@ -177,6 +177,7 @@ void task_work_run(void)
>
> do {
> next = work->next;
> + work->next = TASK_WORK_DEQUEUED;
OK, but then the additional change below makes sense too?
Oleg.
---
--- x/kernel/task_work.c
+++ x/kernel/task_work.c
@@ -106,8 +106,10 @@ task_work_cancel_match(struct task_struc
if (!match(work, data)) {
pprev = &work->next;
work = READ_ONCE(*pprev);
- } else if (try_cmpxchg(pprev, &work, work->next))
+ } else if (try_cmpxchg(pprev, &work, work->next)) {
+ work->next = TASK_WORK_DEQUEUED;
break;
+ }
}
raw_spin_unlock_irqrestore(&task->pi_lock, flags);
Powered by blists - more mailing lists