linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Dan Schatzberg <schatzberg.dan@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>, Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Yosry Ahmed <yosryahmed@google.com>, Huan Yang <link@vivo.com>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org, Tejun Heo <tj@kernel.org>,
	Zefan Li <lizefan.x@bytedance.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shakeel Butt <shakeelb@google.com>,
	Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	SeongJae Park <sj@kernel.org>,
	"Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
	Nhat Pham <nphamcs@gmail.com>, Yue Zhao <findns94@gmail.com>
Subject: Re: [PATCH v5 2/2] mm: add swapiness= arg to memory.reclaim
Date: Wed, 3 Jan 2024 10:03:10 +0100	[thread overview]
Message-ID: <ZZUizpTWOt3gNeqR@tiehlicka> (raw)
In-Reply-To: <ZZQqCHmocwUFvuTz@dschatzberg-fedora-PF3DHTBV>

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@gmail.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


  parent reply	other threads:[~2024-01-03  9:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 15:26 [PATCH v5 0/2] Add swappiness argument to memory.reclaim Dan Schatzberg
2023-12-20 15:26 ` [PATCH v5 1/2] mm: add defines for min/max swappiness Dan Schatzberg
2023-12-21  2:01   ` Nhat Pham
2023-12-22  4:38   ` David Rientjes
2023-12-24 17:14   ` Chris Li
2023-12-20 15:26 ` [PATCH v5 2/2] mm: add swapiness= arg to memory.reclaim Dan Schatzberg
2023-12-21  9:29   ` Michal Hocko
2024-01-02 17:43     ` Dan Schatzberg
2024-01-03  8:59       ` Michal Hocko
2023-12-22  4:38   ` David Rientjes
2023-12-22  5:31   ` Yu Zhao
2024-01-02 15:21     ` Dan Schatzberg
2024-01-03  0:27       ` Yu Zhao
2024-01-03 15:19         ` Dan Schatzberg
2024-01-03  9:03       ` Michal Hocko [this message]
2023-12-24 17:21   ` Chris Li
2024-01-02 22:42   ` Nhat Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZUizpTWOt3gNeqR@tiehlicka \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=findns94@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=link@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan.x@bytedance.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=roman.gushchin@linux.dev \
    --cc=schatzberg.dan@gmail.com \
    --cc=shakeelb@google.com \
    --cc=sj@kernel.org \
    --cc=tj@kernel.org \
    --cc=vishal.moola@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yosryahmed@google.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).