Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4048096pxt; Tue, 10 Aug 2021 18:40:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKyEd3M+oTUpA4siu8Hr36Wc8iI4wTK4R37RA67Gp3TAilggUSONJo2RGo7ZXQlpz/ERg1 X-Received: by 2002:a5d:8e11:: with SMTP id e17mr164941iod.138.1628646000174; Tue, 10 Aug 2021 18:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628646000; cv=none; d=google.com; s=arc-20160816; b=M6DDfWRog8ftYUXvPHq0iUd0bwZiihWDFUJmxqJXc1TZfDP6TrHbi0JJxDUv1KaYTn AV894GSxC/H9EJmfivDV1s6DBYOzg+tcacPY4vaSHqYlW/alT5RKHJtTYO6W6ku4KOvV MxStS/78bSHMtbXJSyVTgjcxtcmGgjzswK8A2uf+AlP79H/5h4tZxC7ibxWWDVcHKYdK 1FCeFB76sePs93WulC/NKSWwWqPeQmz0LvqcTQaMJCL+BOKfpIs0eiZWRHOmrNb18hTp mytktzltqTQSnQ+YseeNTMeIKYjZ4gzkKOX0i7X9hImy7X5d30WsRzTNev0qYZnF3Glg D3fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=90eZDWJTulMurhLbaKwPPHCGtZnjNCnMNCqH3hYNT5c=; b=ksaCVwK8SrkLdhmHVKEdBhnU3evunBbtGnX/HpfM6mFpHqDdDAleC8kI6CMOZxf/E7 dm7CWXYSRW4uWPSzlQFxZxuy1Ud8UH3+aiKKDc67fpWGQYk1vlVvf5eSIFIrGClC1sa3 t+pLmOxDMarK6V2l8nss92IX5rsHldNFqjxiGMBWxFVDZpJE0w54XIletVnd2aPmdsZP Wgl4VosMbvcakR7Be/9Gy8WR5UZfxKo+VtG5JOaZwjf4EtX7XBbl+RH50SiWI0KWbWad J1oehZ8463uAamw36eRc3QAw1CxHdBoqz9MjVYtPl/tIAIp2ir2BSDkwLgQmne6Crgjt onaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si5656990ile.140.2021.08.10.18.39.48; Tue, 10 Aug 2021 18:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbhHKBhy (ORCPT + 99 others); Tue, 10 Aug 2021 21:37:54 -0400 Received: from mga18.intel.com ([134.134.136.126]:50770 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbhHKBhx (ORCPT ); Tue, 10 Aug 2021 21:37:53 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="202201573" X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="202201573" 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >