lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6] hugetlb: Add hugetlb.*.numa_stat file
From
Date
Subject:   Re: [PATCH v6] hugetlb: Add hugetlb.*.numa_stat file

To: Muchun Song <songmuchun@bytedance.com>, Shakeel Butt <shakeelb@google.com>, Mina Almasry <almasrymina@google.com>

Cc: Andrew Morton <akpm@linux-foundation.org>, Shuah Khan <shuah@kernel.org>, Miaohe Lin <linmiaohe@huawei.com>, Oscar Salvador <osalvador@suse.de>, Michal Hocko <mhocko@suse.com>, David Rientjes <rientjes@google.com>, Jue Wang <juew@google.com>, Yang Yao <ygyao@google.com>, Joanna Li <joannali@google.com>, Cannon Matthews <cannonmatthews@google.com>, Linux Memory Management List <linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>

Bcc:

-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-

On 11/14/21 5:43 AM, Muchun Song wrote:

> On Sun, Nov 14, 2021 at 3:15 AM Shakeel Butt <shakeelb@google.com> wrote:

>> On Sat, Nov 13, 2021 at 6:48 AM Mina Almasry <almasrymina@google.com> wrote:

>>> On Fri, Nov 12, 2021 at 6:45 PM Muchun Song <songmuchun@bytedance.com> wrote:

>>>> On Sat, Nov 13, 2021 at 7:36 AM Mike Kravetz <mike.kravetz@oracle.com> wrote:

>> We have following options:

>>

>> 1) Use atomic type for usage.

>> 2) Use "unsigned long" for usage along with WRITE_ONCE/READ_ONCE.

>> 3) Use hugetlb_lock for hugetlb_cgroup_read_numa_stat as well.

>>

>> All options are valid but we would like to avoid (3).

>>

>> What if we use "unsigned long" type but without READ_ONCE/WRITE_ONCE.

>> The potential issues with that are KCSAN will report this as race and

>> possible garbage value on archs which do not support atomic writes to

>> unsigned long.

>

> At least I totally agree with you. Thanks for your detailed explanation.

>



Thanks everyone. This makes sense.



However, I should note that this same situation (updates to unsigned

long variables under lock and reads of the the same variable without

lock or READ/WRITE_ONCE) exists in hugetlb sysfs files today. Not

suggesting that this makes it OK to ignore the potential issue. Just

wanted to point this out.

--

Mike Kravetz

\
 
 \ /
  Last update: 2021-11-16 02:50    [W:0.070 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site