Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1367743
| From | Zefan Li <lizefan@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" |
| Date | 2016-03-31 03:50 +0200 |
| Message-ID | <rizUe-5Lv-9@gated-at.bofh.it> (permalink) |
| References | <rilxT-3RR-9@gated-at.bofh.it> <rilHA-3WZ-17@gated-at.bofh.it> <rim0W-44B-9@gated-at.bofh.it> <rimkh-4wo-11@gated-at.bofh.it> <rizrc-5wZ-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2016/3/31 9:14, Hekuang wrote:
> 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 :)
>
pcp->batch can be changed in a different cpu. You may read percpu_pagelist_fraction_sysctl_handler()
to see how that can happen.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" He Kuang <hekuang@huawei.com> - 2016-03-30 12:30 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Mel Gorman <mgorman@techsingularity.net> - 2016-03-30 12:40 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Hekuang <hekuang@huawei.com> - 2016-03-30 13:00 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Michal Hocko <mhocko@kernel.org> - 2016-03-30 13:20 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Hekuang <hekuang@huawei.com> - 2016-03-31 03:20 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Hekuang <hekuang@huawei.com> - 2016-03-31 03:50 +0200
Re: [PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE" Zefan Li <lizefan@huawei.com> - 2016-03-31 03:50 +0200
csiph-web