From: Dan Williams <dan.j.williams@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.com>, Minchan Kim <minchan@kernel.org>,
Huang Ying <ying.huang@intel.com>,
Wei Yang <richard.weiyang@gmail.com>,
Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH v2 3/3] mm/shuffle: remove dynamic reconfiguration
Date: Tue, 23 Jun 2020 15:18:09 -0700 [thread overview]
Message-ID: <CAPcyv4jOgyc03hbOGMbQcSDTrpLjHbV+bKtbaqVqxWqBt-ezoQ@mail.gmail.com> (raw)
In-Reply-To: <7a5f9ea1-7405-7058-af60-eea0bc165e79@redhat.com>
On Mon, Jun 22, 2020 at 12:33 AM David Hildenbrand <david@redhat.com> wrote:
>
> On 20.06.20 03:49, Dan Williams wrote:
> > On Fri, Jun 19, 2020 at 5:59 AM David Hildenbrand <david@redhat.com> wrote:
> >>
> >> Commit e900a918b098 ("mm: shuffle initial free memory to improve
> >> memory-side-cache utilization") promised "autodetection of a
> >> memory-side-cache (to be added in a follow-on patch)" over a year ago.
> >>
> >> The original series included patches [1], however, they were dropped
> >> during review [2] to be followed-up later.
> >>
> >> Due to lack of platforms that publish an HMAT, autodetection is currently
> >> not implemented. However, manual activation is actively used [3]. Let's
> >> simplify for now and re-add when really (ever?) needed.
> >>
> >> [1] https://lkml.kernel.org/r/154510700291.1941238.817190985966612531.stgit@dwillia2-desk3.amr.corp.intel.com
> >> [2] https://lkml.kernel.org/r/154690326478.676627.103843791978176914.stgit@dwillia2-desk3.amr.corp.intel.com
> >> [3] https://lkml.kernel.org/r/CAPcyv4irwGUU2x+c6b4L=KbB1dnasNKaaZd6oSpYjL9kfsnROQ@mail.gmail.com
> >>
> >> Cc: Andrew Morton <akpm@linux-foundation.org>
> >> Cc: Johannes Weiner <hannes@cmpxchg.org>
> >> Cc: Michal Hocko <mhocko@suse.com>
> >> Cc: Minchan Kim <minchan@kernel.org>
> >> Cc: Huang Ying <ying.huang@intel.com>
> >> Cc: Wei Yang <richard.weiyang@gmail.com>
> >> Cc: Mel Gorman <mgorman@techsingularity.net>
> >> Cc: Dan Williams <dan.j.williams@intel.com>
> >> Signed-off-by: David Hildenbrand <david@redhat.com>
> >> ---
> >> mm/shuffle.c | 28 ++--------------------------
> >> mm/shuffle.h | 17 -----------------
> >> 2 files changed, 2 insertions(+), 43 deletions(-)
> >>
> >> diff --git a/mm/shuffle.c b/mm/shuffle.c
> >> index dd13ab851b3ee..9b5cd4b004b0f 100644
> >> --- a/mm/shuffle.c
> >> +++ b/mm/shuffle.c
> >> @@ -10,33 +10,11 @@
> >> #include "shuffle.h"
> >>
> >> DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
> >> -static unsigned long shuffle_state __ro_after_init;
> >> -
> >> -/*
> >> - * Depending on the architecture, module parameter parsing may run
> >> - * before, or after the cache detection. SHUFFLE_FORCE_DISABLE prevents,
> >> - * or reverts the enabling of the shuffle implementation. SHUFFLE_ENABLE
> >> - * attempts to turn on the implementation, but aborts if it finds
> >> - * SHUFFLE_FORCE_DISABLE already set.
> >> - */
> >> -__meminit void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
> >> -{
> >> - if (ctl == SHUFFLE_FORCE_DISABLE)
> >> - set_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state);
> >> -
> >> - if (test_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state)) {
> >> - if (test_and_clear_bit(SHUFFLE_ENABLE, &shuffle_state))
> >> - static_branch_disable(&page_alloc_shuffle_key);
> >> - } else if (ctl == SHUFFLE_ENABLE
> >> - && !test_and_set_bit(SHUFFLE_ENABLE, &shuffle_state))
> >> - static_branch_enable(&page_alloc_shuffle_key);
> >> -}
> >>
> >> static bool shuffle_param;
> >> static int shuffle_show(char *buffer, const struct kernel_param *kp)
> >> {
> >> - return sprintf(buffer, "%c\n", test_bit(SHUFFLE_ENABLE, &shuffle_state)
> >> - ? 'Y' : 'N');
> >> + return sprintf(buffer, "%c\n", shuffle_param ? 'Y' : 'N');
> >> }
> >>
> >> static __meminit int shuffle_store(const char *val,
> >> @@ -47,9 +25,7 @@ static __meminit int shuffle_store(const char *val,
> >> if (rc < 0)
> >> return rc;
> >> if (shuffle_param)
> >> - page_alloc_shuffle(SHUFFLE_ENABLE);
> >> - else
> >> - page_alloc_shuffle(SHUFFLE_FORCE_DISABLE);
> >> + static_branch_enable(&page_alloc_shuffle_key);
> >> return 0;
> >> }
> >
> > Let's do proper input validation here and require 1 / 'true' to enable
> > shuffling and not also allow 0 to be an 'enable' value.
>
> I don't think that's currently done?
>
> param_set_bool(val, kp) will only default val==NULL to 'true'. Passing 0
> will properly be handled by strtobool(). Or am I missing something?
>
No, I misread the patch and thought the conditional was being removed.
All good now.
next prev parent reply other threads:[~2020-06-23 22:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 12:59 [PATCH v2 0/3] mm/shuffle: fix and cleanups David Hildenbrand
2020-06-19 12:59 ` [PATCH v2 1/3] mm/shuffle: don't move pages between zones and don't read garbage memmaps David Hildenbrand
2020-06-20 1:37 ` Williams, Dan J
2020-06-22 8:26 ` Wei Yang
2020-06-22 8:43 ` David Hildenbrand
2020-06-22 9:22 ` Wei Yang
2020-06-22 9:51 ` David Hildenbrand
2020-06-22 13:10 ` Wei Yang
2020-06-22 14:06 ` David Hildenbrand
2020-06-22 21:55 ` Wei Yang
2020-06-23 7:39 ` David Hildenbrand
2020-06-23 7:55 ` David Hildenbrand
2020-06-23 9:30 ` Wei Yang
2020-07-24 3:08 ` Andrew Morton
2020-07-24 5:45 ` Wei Yang
2020-07-24 8:20 ` David Hildenbrand
2020-06-22 14:11 ` David Hildenbrand
2020-06-19 12:59 ` [PATCH v2 2/3] mm/memory_hotplug: document why shuffle_zone() is relevant David Hildenbrand
2020-06-20 1:41 ` Dan Williams
2020-06-22 7:27 ` David Hildenbrand
2020-06-23 21:15 ` Dan Williams
2020-06-24 9:31 ` David Hildenbrand
2020-06-22 15:32 ` Michal Hocko
2020-06-19 12:59 ` [PATCH v2 3/3] mm/shuffle: remove dynamic reconfiguration David Hildenbrand
2020-06-20 1:49 ` Dan Williams
2020-06-22 7:33 ` David Hildenbrand
2020-06-22 8:37 ` Wei Yang
2020-06-23 22:18 ` Dan Williams [this message]
2020-06-22 15:37 ` Michal Hocko
2020-06-23 1:22 ` Wei Yang
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=CAPcyv4jOgyc03hbOGMbQcSDTrpLjHbV+bKtbaqVqxWqBt-ezoQ@mail.gmail.com \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=richard.weiyang@gmail.com \
--cc=ying.huang@intel.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).