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=-7.0 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,URIBL_BLOCKED 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 BE643C433DF for ; Tue, 23 Jun 2020 22:18:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E1EB20888 for ; Tue, 23 Jun 2020 22:18:24 +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="Nu1h5FTQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E1EB20888 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 04A076B0003; Tue, 23 Jun 2020 18:18:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F16686B0005; Tue, 23 Jun 2020 18:18:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E052F6B0007; Tue, 23 Jun 2020 18:18:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id C669A6B0003 for ; Tue, 23 Jun 2020 18:18:23 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 80EFB181AC9CB for ; Tue, 23 Jun 2020 22:18:23 +0000 (UTC) X-FDA: 76961891286.30.turn08_080c3f626e3f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 5B9CD180B3916 for ; Tue, 23 Jun 2020 22:18:23 +0000 (UTC) X-HE-Tag: turn08_080c3f626e3f X-Filterd-Recvd-Size: 7359 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Tue, 23 Jun 2020 22:18:22 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id a1so310618ejg.12 for ; Tue, 23 Jun 2020 15:18:21 -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=qKzAj5vVSTGG+lmqntyPCD1KCCZpZOcUyhdIG2BFn0o=; b=Nu1h5FTQR7nfTEVl8HRFO0G4X+KLhCz9KWSJ9qfZeKqvxEUEoRza7yKuL3RCqQe2UT LHUIcfwsi/SI+zUbxIcrbMsmSAfDTtq8HK02DuQhf2pNvIpdAfH6hxW8X11yASfhziR/ 3DEHq8y/VXwOfU65qP/pMKIovd8hiWr4BPKtK2tCF8pbGq8pQ9DepmoZ2hHqNnQxkWnF KLo14lwQg/Up+ScK0b5CQsZ83Zp+qg+setx4L/lPNFFwsL+2ldxVNvmNlL1yhfMgPe9x j9+9q4uBSMVAgjnKjUBkvL1MzQE7s4Rac1crinxmF6450keElPqwlRWs75Ypy/pQc/Ut Cisg== 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=qKzAj5vVSTGG+lmqntyPCD1KCCZpZOcUyhdIG2BFn0o=; b=mteSucBdlD9Rb2TKR7VHTzo2DgqpBE/7rzIB5aby8xN2KsknYBU2t3q5QoDpAt7VeQ 9d0gyQLNRHqWIoyOGvIqcq/GuOLzF+DgmVXK/b/C9KUXFNBJVE14NwajpWkEhuMKUrhV pynZ3pKXcRNylyKfrKxSsRbVKe891lyQtQlu2pb5ap6Wbnr8nLOWh/vvFu1NMhmkuypf CZWw3XDvsshn1MEn3uFDYvpULMzfS6IoYsvNoQHAg8OYB1bOnbDjH6y2envxKTuYvC8N QoDC6ccbL5twlJKyBqQnb1RVDnuZ/BvmFkvup99K4iff1frxRtEDyGJ1sIJUYiMBudUe WqGQ== X-Gm-Message-State: AOAM533RB0VY9yRd65Y41CsvOAOoZZBO3S4JI7yylJXYdMfWqMCt7hlQ AB0pRMYMlymdJmnK9VSO5TqMqjDVLj8m3M1l2eqTxQ== X-Google-Smtp-Source: ABdhPJwp8p0x5w/MAR9g9ZdE/7poFPIkrBvB0bYc9yWtOursXvzRpQkVd+QjErbQ+HmOoQ5AujQOUwP4vvzBqq6ZFiw= X-Received: by 2002:a17:906:6d56:: with SMTP id a22mr16811990ejt.440.1592950700787; Tue, 23 Jun 2020 15:18:20 -0700 (PDT) MIME-Version: 1.0 References: <20200619125923.22602-1-david@redhat.com> <20200619125923.22602-4-david@redhat.com> <7a5f9ea1-7405-7058-af60-eea0bc165e79@redhat.com> In-Reply-To: <7a5f9ea1-7405-7058-af60-eea0bc165e79@redhat.com> From: Dan Williams Date: Tue, 23 Jun 2020 15:18:09 -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: 5B9CD180B3916 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Mon, Jun 22, 2020 at 12:33 AM David Hildenbrand wrote: > > On 20.06.20 03:49, Dan Williams wrote: > > 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. > > 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.