lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 31 Mar 2021 08:22:41 +0200
From:   Christian Borntraeger <borntraeger@...ibm.com>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     Stephen Rothwell <sfr@...b.auug.org.au>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Yang Shi <shy828301@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-s390 <linux-s390@...r.kernel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...nel.org>, Roman Gushchin <guro@...com>,
        Shakeel Butt <shakeelb@...gle.com>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Xiongchun Duan <duanxiongchun@...edance.com>
Subject: RE: kernel warning percpu ref in obj_cgroup_release



On 30.03.21 18:25, Muchun Song wrote:
> On Tue, Mar 30, 2021 at 11:10 PM Christian Borntraeger
> <borntraeger@...ibm.com> wrote:
>>
>>
>> On 30.03.21 15:49, Muchun Song wrote:
>>> On Tue, Mar 30, 2021 at 9:27 PM Christian Borntraeger
>>> <borntraeger@...ibm.com> wrote:
>>>>
>>>> So bisect shows this for belows warning:
>>>
>>> Thanks for your effort on this. Can you share your config?
>>
>> attached (but its s390x) for next-20210330
> 
> Thanks. Can you apply the following patch and help me test?
> Very Thanks.
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 7fdc92e1983e..579408e4d46f 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -793,6 +793,12 @@ static inline void obj_cgroup_get(struct obj_cgroup *objcg)
>          percpu_ref_get(&objcg->refcnt);
>   }
> 
> +static inline void obj_cgroup_get_many(struct obj_cgroup *objcg,
> +                                      unsigned long nr)
> +{
> +       percpu_ref_get_many(&objcg->refcnt, nr);
> +}
> +
>   static inline void obj_cgroup_put(struct obj_cgroup *objcg)
>   {
>          percpu_ref_put(&objcg->refcnt);
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c0b83a396299..1634dba1044c 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3133,7 +3133,10 @@ void split_page_memcg(struct page *head, unsigned int nr)
> 
>          for (i = 1; i < nr; i++)
>                  head[i].memcg_data = head->memcg_data;
> -       css_get_many(&memcg->css, nr - 1);
> +       if (PageMemcgKmem(head))
> +               obj_cgroup_get_many(__page_objcg(head), nr - 1);
> +       else
> +               css_get_many(&memcg->css, nr - 1);
>   }
> 
>   #ifdef CONFIG_MEMCG_SWAP
> 

This one seems to do the trick, I can no longer see the warning.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ