[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170126104732.meri27v5lf3or22j@techsingularity.net>
Date: Thu, 26 Jan 2017 10:47:32 +0000
From: Mel Gorman <mgorman@...hsingularity.net>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Tejun Heo <tj@...nel.org>, Vlastimil Babka <vbabka@...e.cz>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Hillf Danton <hillf.zj@...baba-inc.com>,
Jesper Dangaard Brouer <brouer@...hat.com>
Subject: Re: [PATCH] mm, page_alloc: Use static global work_struct for
draining per-cpu pages
On Wed, Jan 25, 2017 at 04:08:02PM -0800, Andrew Morton wrote:
> > + for_each_cpu(cpu, &cpus_with_pcps) {
> > + struct work_struct *work = per_cpu_ptr(&pcpu_drain, cpu);
> > + INIT_WORK(work, drain_local_pages_wq);
>
> It's strange to repeatedly run INIT_WORK() in this fashion.
> Overwriting an atomic_t which should already be zero, initializing a
> list_head which should already be in the initialized state...
>
> Can we instead do this a single time in init code?
>
INIT_WORK does different things depending on whether LOCKDEP is enabled or
not and also whether object debugging is enabled. I'd worry that it's not
functionally equivalent or some future change would break the assumptions
about what INIT_WORK does internally. The init cost is there, but it's
insignicant in comparison to the whole workqueue operation or the old
cost of sending IPIs for that matter.
--
Mel Gorman
SUSE Labs
Powered by blists - more mailing lists