From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 482C2C433E0 for ; Sat, 20 Jun 2020 01:50:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0481320706 for ; Sat, 20 Jun 2020 01:50:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="xavAsDmM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0481320706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 92DB36B0099; Fri, 19 Jun 2020 21:50:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DEC38D0005; Fri, 19 Jun 2020 21:50:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F3FF6B009B; Fri, 19 Jun 2020 21:50:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 672F76B0099 for ; Fri, 19 Jun 2020 21:50:13 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EF19A1EE6 for ; Sat, 20 Jun 2020 01:50:12 +0000 (UTC) X-FDA: 76947909864.25.crib26_420043a26e1d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id C2C5B1804E3A0 for ; Sat, 20 Jun 2020 01:50:12 +0000 (UTC) X-HE-Tag: crib26_420043a26e1d X-Filterd-Recvd-Size: 6883 Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Sat, 20 Jun 2020 01:50:12 +0000 (UTC) Received: by mail-ej1-f66.google.com with SMTP id k11so12207006ejr.9 for ; Fri, 19 Jun 2020 18:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=twWNVQ4JBSVnYybiZHHXD67URFG/e2UgNtu29WZERs8=; b=xavAsDmM7sRSxbBu/yKvIp3Lp4R0Bsu+h9uDpuZEVL98qayjabgZXEjzGGr/HojQZs UpxuRJ25mdfXkWVW6a2baEND3MUOUBPxaH3sydXtGsM7qP4lzVqNXomvOdwM8OGszrBG p+zTpGbtstHfuz512UqswzqJSBXIOkULJMPFaej9rlMhbdg6fUCOwIhFgRQcAFPaNv15 8YG9mxyDcPd5kxifNcvoxwnElwqomShFvrKS5Y1M6x74uWcVgkcl/U0A06iCROo2N4ED RXuGRs5Zx9UJwuAgAjN13HyaeITMQxpbc101A4Bko0UzCYaUi7N+dp4M08ovX9y1Btw6 qTYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=twWNVQ4JBSVnYybiZHHXD67URFG/e2UgNtu29WZERs8=; b=Z/RYg5R3QVwM7azT4B0nltNmX16K01FnfnZ/iO95bhWtcXElju6B8/vDWppBNlCHnY mPhJND9VK6h8QGcO0CR3VM1EXIjFSfP9aIZJTyq3EsVL/3nLAYqoQ0QVMFgZTBCFR+nE zqA9J/DfTtxLXuqxWFwZqTozg81itLvorBwd8+YcUdWVp1cHnKkkzX6/2t09gjuu9e86 pJr3mMrc43PzGRR2lRyyhJ1CjmkbScBDddCDIkux7zyGAhH7RktI0xbawaHXVdmRZjtJ +k0WEuK5J7bCJOD2QApT0CIz8t+P7HGn14/eahvk5ZK+IjalN/14mecmcmXEH90FNrtM qTkw== X-Gm-Message-State: AOAM531rP9hwBT8IPtHaXJJnX5E4KUsj7UgQaNfSqNpdFZf7DeNlhiSr j96dsrCvt9f6GGa6fw/gjGs4Ilnm1oyOBpoplolqww== X-Google-Smtp-Source: ABdhPJyvN9t1Im80WqG/55D6zkuo0TpscIp3tYPFylkOLRRBVms1HpP94gyuRN6s/4qqFgU9cZEWZc0bmgB4AW3BXzw= X-Received: by 2002:a17:906:bcfc:: with SMTP id op28mr5937381ejb.237.1592617810660; Fri, 19 Jun 2020 18:50:10 -0700 (PDT) MIME-Version: 1.0 References: <20200619125923.22602-1-david@redhat.com> <20200619125923.22602-4-david@redhat.com> In-Reply-To: <20200619125923.22602-4-david@redhat.com> From: Dan Williams Date: Fri, 19 Jun 2020 18:49:59 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] mm/shuffle: remove dynamic reconfiguration To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux MM , Andrew Morton , Johannes Weiner , Michal Hocko , Minchan Kim , Huang Ying , Wei Yang , Mel Gorman Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: C2C5B1804E3A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 19, 2020 at 5:59 AM David Hildenbrand 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 > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Minchan Kim > Cc: Huang Ying > Cc: Wei Yang > Cc: Mel Gorman > Cc: Dan Williams > Signed-off-by: David Hildenbrand > --- > 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. Other than that looks like the right move to me until end users or distros start asking for the kernel to do this by default, I'm not aware of any of those requests to date. People seem fine to set the boot option. After the above fixups you can add: Acked-by: Dan Williams