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: <ZZUizpTWOt3gNeqR@tiehlicka>
Date: Wed, 3 Jan 2024 10:03:10 +0100
From: Michal Hocko <mhocko@...e.com>
To: Dan Schatzberg <schatzberg.dan@...il.com>
Cc: Yu Zhao <yuzhao@...gle.com>, 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>,
	Shakeel Butt <shakeelb@...gle.com>,
	Muchun Song <muchun.song@...ux.dev>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kefeng Wang <wangkefeng.wang@...wei.com>,
	SeongJae Park <sj@...nel.org>,
	"Vishal Moola (Oracle)" <vishal.moola@...il.com>,
	Nhat Pham <nphamcs@...il.com>, Yue Zhao <findns94@...il.com>
Subject: Re: [PATCH v5 2/2] mm: add swapiness= arg to memory.reclaim

On Tue 02-01-24 10:21:44, Dan Schatzberg wrote:
> Hi Yu Zhao,
> 
> Thanks for the feedback, sorry for the delayed response.
> 
> On Thu, Dec 21, 2023 at 10:31:59PM -0700, Yu Zhao wrote:
> > On Wed, Dec 20, 2023 at 8:27 AM Dan Schatzberg <schatzberg.dan@...il.com> wrote:
> > >
> > > ...
> > 
> > The cover letter says:
> > "Previously, this exact interface addition was proposed by Yosry[3]."
> > 
> > So I think it should be acknowledged with a Suggested-by, based on:
> > "A Suggested-by: tag indicates that the patch idea is suggested by the
> > person named and ensures credit to the person for the idea."
> > from
> > https://docs.kernel.org/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes
> 
> Sure, will do.
> 
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index d91963e2d47f..aa5666842c49 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -92,6 +92,9 @@ struct scan_control {
> > >         unsigned long   anon_cost;
> > >         unsigned long   file_cost;
> > >
> > > +       /* Swappiness value for reclaim. NULL will fall back to per-memcg/global value */
> > > +       int *swappiness;
> > 
> > Using a pointer to indicate whether the type it points to is
> > overridden isn't really a good practice.
> > 
> > A better alternative was suggested during the v2:
> > "Perhaps the negative to avoid unnecessary dereferences."
> > https://lore.kernel.org/linux-mm/dhhjw4h22q4ngwtxmhuyifv32zjd6z2relrcjgnxsw6zys3mod@o6dh5dy53ae3/
> 
> I did have a couple versions with a negative but it creates
> initialization issues where every instantiation of scan_control needs
> to make sure to initialize swappiness or else it will behave as if
> swappiness is 0. That's pretty error prone so using the pointer seemed
> the better approach.

I do agree with this. Especially for an opt-in features it is better if
the default initialization has a clear meanining. In this case even if
somebody doesn't use the helper then the NULL should be caught as NULL
ptr rather than a silent misbehavior.
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ