[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ch4RM5rKrYLKrny3yt3ciK87aqzJ8Wt3ze87u9KBHjyXg@mail.gmail.com>
Date: Tue, 24 Aug 2021 12:40:40 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
Subject: Re: [RFC PATCH v3 08/15] perf workqueue: add queue_work and
flush_workqueue functions
On Fri, Aug 20, 2021 at 3:54 AM Riccardo Mancini <rickyman7@...il.com> wrote:
>
> This patch adds functions to queue and wait work_structs, and
> related tests.
>
> When a new work item is added, the workqueue first checks if there
> are threads to wake up. If so, it wakes it up with the given work item,
> otherwise it will pick the next round-robin thread and queue the work
> item to its queue. A thread which completes its queue will go to sleep.
>
> The round-robin mechanism is implemented through the next_worker
> attibute which will point to the next worker to be chosen for queueing.
> When work is assigned to that worker or when the worker goes to sleep,
> the pointer is moved to the next worker in the busy_list, if any.
> When a worker is woken up, it is added in the busy list just before the
> next_worker, so that it will be chosen as last (it's just been assigned
> a work item).
Do we really need this? I think some of the complexity comes
because of this. Can we simply put the works in a list in wq
and workers take it out with a lock? Then the kernel will
distribute the works among the threads for us.
Maybe we can get rid of worker->lock too..
Thanks,
Namhyung
Powered by blists - more mailing lists