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: <ZXnexTxt3JE8mEMV@dschatzberg-fedora-PF3DHTBV>
Date:   Wed, 13 Dec 2023 11:41:41 -0500
From:   Dan Schatzberg <schatzberg.dan@...il.com>
To:     Huan Yang <11133793@...o.com>
Cc:     Johannes Weiner <hannes@...xchg.org>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Yosry Ahmed <yosryahmed@...gle.com>, Huan Yang <link@...o.com>,
        linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
        linux-mm@...ck.org, Tejun Heo <tj@...nel.org>,
        Zefan Li <lizefan.x@...edance.com>,
        Jonathan Corbet <corbet@....net>,
        Michal Hocko <mhocko@...nel.org>,
        Shakeel Butt <shakeelb@...gle.com>,
        Muchun Song <muchun.song@...ux.dev>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Hildenbrand <david@...hat.com>,
        Matthew Wilcox <willy@...radead.org>,
        Chris Li <chrisl@...nel.org>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Yue Zhao <findns94@...il.com>, Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH V4 1/2] mm: add defines for min/max swappiness

On Wed, Dec 13, 2023 at 09:58:26AM +0800, Huan Yang wrote:
> 
> 在 2023/12/13 9:38, Dan Schatzberg 写道:
> > [????????? schatzberg.dan@...il.com ????????? https://aka.ms/LearnAboutSenderIdentification,????????????]
> > 
> > We use the constants 0 and 200 in a few places in the mm code when
> > referring to the min and max swappiness. This patch adds MIN_SWAPPINESS
> > and MAX_SWAPPINESS #defines to improve clarity. There are no functional
> > changes.
> > 
> > Signed-off-by: Dan Schatzberg <schatzberg.dan@...il.com>
> > ---
> >   include/linux/swap.h |  2 ++
> >   mm/memcontrol.c      |  2 +-
> >   mm/vmscan.c          | 10 +++++-----
> >   3 files changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/include/linux/swap.h b/include/linux/swap.h
> > index f6dd6575b905..e2ab76c25b4a 100644
> > --- a/include/linux/swap.h
> > +++ b/include/linux/swap.h
> > @@ -407,6 +407,8 @@ extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> > 
> >   #define MEMCG_RECLAIM_MAY_SWAP (1 << 1)
> >   #define MEMCG_RECLAIM_PROACTIVE (1 << 2)
> > +#define MIN_SWAPPINESS 0
> > +#define MAX_SWAPPINESS 200
> 
> Do MAX_SWAPPINESS apply for all swapppiness? If so, maybe better change
> swappiness sysctl define:
> ```
> sysctl.c:
> 
> {
>         .procname    = "swappiness",
>         .data        = &vm_swappiness,
>         .maxlen        = sizeof(vm_swappiness),
>         .mode        = 0644,
>         .proc_handler    = proc_dointvec_minmax,
>         .extra1        = SYSCTL_ZERO,
>         .extra2        = SYSCTL_TWO_HUNDRED,
>     },
> 
> ```
> 
> Here hard code swappiness in [0, 200], and now add a new define.

Yes, MAX_SWAPPINESS is a hard limit. I'm not sure what you're
proposing here - the SYSCTL_ZERO and SYSCTL_TWO_HUNDRED values are a
little different than the defines I added. I think most of the value
is just consistently using the defines in the core mm code.

> 
> And many other code hard reference 200 into max value of swappiness, like:
> 
> ```
> memcontrol.c:
> static int mem_cgroup_swappiness_write(struct cgroup_subsys_state *css,
>                        struct cftype *cft, u64 val)
> {
>     struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> 
>     if (val > 200)
>         return -EINVAL;
> 
>     if (!mem_cgroup_is_root(memcg))
>         memcg->swappiness = val;
>     else
>         vm_swappiness = val;
> 
>     return 0;
> }

This one is already fixed in my patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ