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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 A0987C432BE for ; Wed, 11 Aug 2021 01:37:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40DE460720 for ; Wed, 11 Aug 2021 01:37:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 40DE460720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C3C336B0073; Tue, 10 Aug 2021 21:37:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEC166B0074; Tue, 10 Aug 2021 21:37:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADA7E8D0001; Tue, 10 Aug 2021 21:37:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 921626B0073 for ; Tue, 10 Aug 2021 21:37:33 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3058F181FE07C for ; Wed, 11 Aug 2021 01:37:33 +0000 (UTC) X-FDA: 78461087586.26.D17C85C Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf13.hostedemail.com (Postfix) with ESMTP id 144831025F0E for ; Wed, 11 Aug 2021 01:37:31 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="202201574" X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="202201574" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 18:37:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="516263485" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.151]) by FMSMGA003.fm.intel.com with ESMTP; 10 Aug 2021 18:37:25 -0700 Date: Wed, 11 Aug 2021 09:37:24 +0800 From: Feng Tang To: Hugh Dickins Cc: Michal Hocko , Andrew Morton , linux-mm@kvack.org, David Rientjes , Dave Hansen , Ben Widawsky , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andrea Arcangeli , Mel Gorman , Mike Kravetz , Randy Dunlap , Vlastimil Babka , Andi Kleen , Dan Williams , ying.huang@intel.com Subject: Re: [PATCH v7 3/5] mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY Message-ID: <20210811013724.GB2474@shbuild999.sh.intel.com> References: <1627970362-61305-1-git-send-email-feng.tang@intel.com> <1627970362-61305-4-git-send-email-feng.tang@intel.com> <20210809024430.GA46432@shbuild999.sh.intel.com> <20210809123747.GB46432@shbuild999.sh.intel.com> <20210810085048.GA67328@shbuild999.sh.intel.com> <81f33a1-8ff-f2d4-63ff-de6c81d86f3@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81f33a1-8ff-f2d4-63ff-de6c81d86f3@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 144831025F0E Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf13.hostedemail.com: domain of feng.tang@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=feng.tang@intel.com X-Stat-Signature: iomiyrnsybqww3p5zyyhccdcg83cjfga X-HE-Tag: 1628645851-200161 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: Hi Huge, On Tue, Aug 10, 2021 at 02:35:05PM -0700, Hugh Dickins wrote: > On Tue, 10 Aug 2021, Feng Tang wrote: > > On Mon, Aug 09, 2021 at 03:19:32PM +0200, Michal Hocko wrote: > > [snip] > > > > > Do you think you can provide same helpers for other policies as well? > > > > > Maybe we can get rid of some other ifdefery as well. > > > > > > > > Sure. I can make separate patch(es) for that. > > > > > > > > And you mean helper like mpol_is_bind/default/local/preferred? > > > > > > > > I just run 'git-grep MPOL', and for places using "mode == MPOL_XXX", > > > > mostly they are in mempolicy.[ch], the only another place is in > > > > shmem.c, do we need to create all the helpers for it and the > > > > potential future users? > > > > > > I would just go with those instances which need to ifdef for NUMA. > > > Thanks! > > > > Yes, following is a patch to remove one CONFIG_NUMA check, though > > an bolder idea to extend the patch by removing the CONFIG_TMPFS > > check in the same line. > > > > Thanks, > > Feng > > > > ---------8<--------------------------------- > > > > From 1a5858721ac8ce99c27c13d310bba2983dc73d97 Mon Sep 17 00:00:00 2001 > > From: Feng Tang > > Date: Tue, 10 Aug 2021 17:00:59 +0800 > > Subject: [PATCH] mm: shmem: avoid open coded check for mempolicy's mode > > > > Add a mempolicy helper to do the check, which can also remove > > a CONFIG_NUMA option check. > > > > Suggested-by: Michal Hocko > > Signed-off-by: Feng Tang > > No thanks: this is not an improvement. > > The "#if defined(CONFIG_NUMA) && defined(CONFIG_TMPFS)" is there to > eliminate dead code that would not be automatically eliminated by the > optimizer: it's not there just to avoid MPOL_DEFAULT, and it's there > to cover shmem_get_sbmpol() along with shmem_show_mpol(). Thanks for the explaination! I did some tests that in !NUMA case, the 'sbinfo->mpol' is always NULL (I could be wrong) which makes the 2 functions almost non-ops. > I know we tend to avoid #ifdefs in .c files, and that's good; and > I know you could find other code in mm/shmem.c which might also be > #ifdef'ed to eliminate other dead code in other configs; but unless > there's a new drive to purge our .c source of all #ifdefs, > please just leave this as is. Ok, and sorry for the noise. Thanks, Feng > Thanks, > Hugh >