[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160330111044.GA4324@dhcp22.suse.cz>
Date: Wed, 30 Mar 2016 13:10:44 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Hekuang <hekuang@...wei.com>
Cc: Mel Gorman <mgorman@...hsingularity.net>,
akpm@...ux-foundation.org, vbabka@...e.cz, rientjes@...gle.com,
cody@...ux.vnet.ibm.com, gilad@...yossef.com,
kosaki.motohiro@...il.com, mgorman@...e.de, penberg@...nel.org,
lizefan@...wei.com, wangnan0@...wei.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with
ACCESS_ONCE"
On Wed 30-03-16 18:51:12, Hekuang wrote:
> hi
>
> 在 2016/3/30 18:38, Mel Gorman 写道:
> >On Wed, Mar 30, 2016 at 10:22:07AM +0000, He Kuang wrote:
> >>This reverts commit 998d39cb236fe464af86a3492a24d2f67ee1efc2.
> >>
> >>When local irq is disabled, a percpu variable does not change, so we can
> >>remove the access macros and let the compiler optimize the code safely.
> >>
> >batch can be changed from other contexts. Why is this safe?
> >
> I've mistakenly thought that per_cpu variable can only be accessed by that
> cpu.
git blame would point you to 998d39cb236f ("mm/page_alloc: protect
pcp->batch accesses with ACCESS_ONCE"). I haven't looked into the code
deeply to confirm this is still the case but it would be a good lead
that this is not that simple. ACCESS_ONCE resp. {READ,WRITE}_ONCE are
usually quite subtle so I would encourage you or anybody else who try to
remove them to study the code and the history deeper before removing
them.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists