All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hekuang <hekuang@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>,
	akpm@linux-foundation.org, vbabka@suse.cz, rientjes@google.com,
	cody@linux.vnet.ibm.com, gilad@benyossef.com,
	kosaki.motohiro@gmail.com, mgorman@suse.de, penberg@kernel.org,
	lizefan@huawei.com, wangnan0@huawei.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE"
Date: Thu, 31 Mar 2016 09:14:42 +0800	[thread overview]
Message-ID: <56FC7A02.1080201@huawei.com> (raw)
In-Reply-To: <20160330111044.GA4324@dhcp22.suse.cz>

Hi

a?? 2016/3/30 19:10, Michal Hocko a??e??:
> On Wed 30-03-16 18:51:12, Hekuang wrote:
>> hi
>>
>> a?? 2016/3/30 18:38, Mel Gorman a??e??:
>>> 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.
>
Thank you for responding, I've read that commit and related articles and 
not sending
mail casually, though you may think it's a stupid patch. I'm a beginner 
and I think
sending mails to maillist is a effective way to learn kernel, And, sure 
i'll be more careful and
well prepared next time :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Hekuang <hekuang@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>,
	<akpm@linux-foundation.org>, <vbabka@suse.cz>,
	<rientjes@google.com>, <cody@linux.vnet.ibm.com>,
	<gilad@benyossef.com>, <kosaki.motohiro@gmail.com>,
	<mgorman@suse.de>, <penberg@kernel.org>, <lizefan@huawei.com>,
	<wangnan0@huawei.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE"
Date: Thu, 31 Mar 2016 09:14:42 +0800	[thread overview]
Message-ID: <56FC7A02.1080201@huawei.com> (raw)
In-Reply-To: <20160330111044.GA4324@dhcp22.suse.cz>

Hi

在 2016/3/30 19:10, Michal Hocko 写道:
> 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.
>
Thank you for responding, I've read that commit and related articles and 
not sending
mail casually, though you may think it's a stupid patch. I'm a beginner 
and I think
sending mails to maillist is a effective way to learn kernel, And, sure 
i'll be more careful and
well prepared next time :)

  reply	other threads:[~2016-03-31  1:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 10:22 [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" He Kuang
2016-03-30 10:22 ` He Kuang
2016-03-30 10:38 ` Mel Gorman
2016-03-30 10:38   ` Mel Gorman
2016-03-30 10:51   ` Hekuang
2016-03-30 10:51     ` Hekuang
2016-03-30 11:10     ` Michal Hocko
2016-03-30 11:10       ` Michal Hocko
2016-03-31  1:14       ` Hekuang [this message]
2016-03-31  1:14         ` Hekuang
2016-03-31  1:39         ` Zefan Li
2016-03-31  1:39           ` Zefan Li
2016-03-31  1:47           ` Hekuang
2016-03-31  1:47             ` Hekuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FC7A02.1080201@huawei.com \
    --to=hekuang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=cody@linux.vnet.ibm.com \
    --cc=gilad@benyossef.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=mgorman@suse.de \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.