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]
Message-ID: <Y7PoBkLyCaH1KHbB@dhcp22.suse.cz>
Date:   Tue, 3 Jan 2023 09:32:06 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     김재원 <jaewon31.kim@...sung.com>
Cc:     "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "hannes@...xchg.org" <hannes@...xchg.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "jaewon31.kim@...il.com" <jaewon31.kim@...il.com>
Subject: Re: (2) [PATCH] page_alloc: avoid the negative free for meminfo
 available

On Tue 03-01-23 17:20:08, 김재원 wrote:
> >On Tue 03-01-23 16:28:07, Jaewon Kim wrote:
> >> The totalreserve_pages could be higher than the free because of
> >> watermark high or watermark boost. Handle this situation and fix it to 0
> >> free size.
> >
> >What is the actual problem you are trying to address by this change?
> 
> Hello
> 
> As described on the original commit,
>   34e431b0ae39 /proc/meminfo: provide estimated available memory
> mm is tring to provide the avaiable memory to user space.
> 
> But if free is negative, the available memory shown to userspace
> would be shown smaller thatn the actual available size. The userspace
> may do unwanted memory shrinking actions like process kills.

Do you have any specific example? Have you seen this happening in
practice or is this based on the code inspection?

Also does this patch actually fix anything? Say the system is really
struggling and we are under min watermark. Shouldn't that lead to
Available to be reported as 0 without even looking at other counters?

> I think the logic sholud account the positive size only.
> 
> BR
> 
> >
> >> Signed-off-by: Jaewon Kim <jaewon31.kim@...sung.com>
> >> ---
> >>  mm/page_alloc.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >> 
> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >> index 218b28ee49ed..e510ae83d5f3 100644
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -5948,6 +5948,8 @@ long si_mem_available(void)
> >>  	 * without causing swapping or OOM.
> >>  	 */
> >>  	available = global_zone_page_state(NR_FREE_PAGES) - totalreserve_pages;
> >> +	if (available < 0)
> >> +		available = 0;
> >>  
> >>  	/*
> >>  	 * Not all the page cache can be freed, otherwise the system will
> >> -- 
> >> 2.17.1
> >
> >-- 
> >Michal Hocko
> >SUSE Labs
> 
> 
> 
>  
> --------- Original Message ---------
> Sender : Michal Hocko <mhocko@...e.com>
> Date : 2023-01-03 17:03 (GMT+9)
> Title : Re: [PATCH] page_alloc: avoid the negative free for meminfo available
>  
> On Tue 03-01-23 16:28:07, Jaewon Kim wrote:
> > The totalreserve_pages could be higher than the free because of
> > watermark high or watermark boost. Handle this situation and fix it to 0
> > free size.
> 
> What is the actual problem you are trying to address by this change?
> 
> > Signed-off-by: Jaewon Kim <jaewon31.kim@...sung.com>
> > ---
> >  mm/page_alloc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 218b28ee49ed..e510ae83d5f3 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -5948,6 +5948,8 @@ long si_mem_available(void)
> >           * without causing swapping or OOM.
> >           */
> >          available = global_zone_page_state(NR_FREE_PAGES) - totalreserve_pages;
> > +        if (available < 0)
> > +                available = 0;
> >  
> >          /*
> >           * Not all the page cache can be freed, otherwise the system will
> > -- 
> > 2.17.1
> 
> -- 
> Michal Hocko
> SUSE Labs
> 

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ