Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp210753iog; Mon, 13 Jun 2022 00:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHSJ+A8xuzxS6fUKGyMP2CI+KpRcosBOzNAfSgUF9K6keJFT82lh/y0bVNTnlUkInB+xJ8 X-Received: by 2002:a17:906:72d2:b0:712:302b:a1d9 with SMTP id m18-20020a17090672d200b00712302ba1d9mr12401136ejl.539.1655105260455; Mon, 13 Jun 2022 00:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655105260; cv=none; d=google.com; s=arc-20160816; b=zN+dDrqm7+Vztv6ynYWQDzuLym9Mbog+FmlkwH7f+6DxDyKysd3nBEgrNC++Q2AaFK CwAPfFv0jmCsXthlYfqGJWlsa3atBfpPc2LsgNIvG/joEVbRt8WyWiCKSg2UOXoFvjc8 RQpHqJ6z1OMRQPjo1w+H7HVFgRWvXF9knmaZK0aBN9SM7b/sEKsyj65jNihwTB/g4Tww dfYCWBdPE7wK1gGRjPLrW0VhVO392oa4d1Fdfy7a3e15E3vzD1iHJ4/nM4H/3ncAAmzR HpdoUlljVSb5tSEN9r/EFsvpKRIKdFNBImNiszkkFOA5S4dav+kNlt3UWPVBZ+DDi37n JbPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=kHTKPRyvqj5750oduopTRRwxZ/fyFzffKUCouJbXbUc=; b=kZAU3YAOLUpqfXmVryVrWPlgTxeO7AZeRfE5LJZtyR0B221m5Sv9Jvz5o9DvNz3zc6 bP9Z53Ysznt1VqxSaKLc4zynscC9J9Y4InAHKvyGRrmh7ZoRdKXaqk9LiZG67RS12y+e RkdgUxAQvQx0TWVg+9W3+0f4AlcoyvA5d/FE4YVch2zg8bcp9wtRaxcY9Ej+rP3cc/yF p6ktvhLTk6Ps5DAKB/BRGWVzTx8LiuZd8DxlB3WP4VSkwNaIdNGwCU/ieTgu+KHYTRv9 waSqju6etpxRGny1WP9wds8Vp/2u2FxfehhUhtGxbYCXLY6HKzJI2IXMIiwjPTiShEJe VrqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L8NYmZR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056402358b00b0042888eee944si8029627edc.471.2022.06.13.00.27.15; Mon, 13 Jun 2022 00:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L8NYmZR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238762AbiFMHIq (ORCPT + 99 others); Mon, 13 Jun 2022 03:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbiFMHIK (ORCPT ); Mon, 13 Jun 2022 03:08:10 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7B6A6324 for ; Mon, 13 Jun 2022 00:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655104089; x=1686640089; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=4ZL5x0SSS5qZVmA+JgyUkPjLyNtKpHowUfKdZup163A=; b=L8NYmZR8jMyeK+1owr5MTSCzv2AMh7KmkiHSMnV7kWHzLIrWm2MQkcQz 5boTAInpsR+04TDoWqu609sWQJJ7g4u1tOIwGFZ7n7F2m6sTB/9AC2fqM e1Kfymih0cUyZh4jDxdSGFIvRAuno15IRAFORx5C4ec9JIOBxF3GVHvNu OnrDJySms6F03KEIn9sYLVE+K4oZt0nEVBg0JSJDdt/fvkrBJNwUWMvwB ZMnqR23RgRF6myRKzJbzROaBct+yAR5QDeE1yMK73feQZt6A6LnyK0ej7 aIIqHeIsrNeSCz+HtAWP4b+OjNBkEWcNKV43Gko4fRsyTeOlzkkhfqOHV w==; X-IronPort-AV: E=McAfee;i="6400,9594,10376"; a="279240371" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="279240371" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2022 00:08:04 -0700 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="651263450" Received: from xinyangc-mobl.ccr.corp.intel.com ([10.254.214.65]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2022 00:07:59 -0700 Message-ID: Subject: Re: [PATCH v6 09/13] mm/demotion: Add pg_data_t member to track node memory tier details From: Ying Huang To: "Aneesh Kumar K.V" , linux-mm@kvack.org, akpm@linux-foundation.org Cc: Wei Xu , Greg Thelen , Yang Shi , Davidlohr Bueso , Tim C Chen , Brice Goglin , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Feng Tang , Jagdish Gediya , Baolin Wang , David Rientjes Date: Mon, 13 Jun 2022 15:07:57 +0800 In-Reply-To: <20220610135229.182859-10-aneesh.kumar@linux.ibm.com> References: <20220610135229.182859-1-aneesh.kumar@linux.ibm.com> <20220610135229.182859-10-aneesh.kumar@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-06-10 at 19:22 +0530, Aneesh Kumar K.V wrote: > Also update different helpes to use NODE_DATA()->memtier. Since > node specific memtier can change based on the reassignment of > NUMA node to a different memory tiers, accessing NODE_DATA()->memtier > needs to under an rcu read lock of memory_tier_lock. > > Signed-off-by: Aneesh Kumar K.V > --- >  include/linux/memory-tiers.h | 14 +++++ >  include/linux/mmzone.h | 3 ++ >  mm/memory-tiers.c | 102 ++++++++++++++++++++++++++--------- >  3 files changed, 94 insertions(+), 25 deletions(-) > > diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h > index 52896f5970b7..53f3e4c7cba8 100644 > --- a/include/linux/memory-tiers.h > +++ b/include/linux/memory-tiers.h > @@ -6,6 +6,9 @@ >   > >  #ifdef CONFIG_TIERED_MEMORY >   > > +#include > +#include > + >  #define MEMORY_TIER_HBM_GPU 0 >  #define MEMORY_TIER_DRAM 1 >  #define MEMORY_TIER_PMEM 2 > @@ -18,13 +21,24 @@ >  #define MAX_STATIC_MEMORY_TIERS 3 >  #define MAX_MEMORY_TIERS (MAX_STATIC_MEMORY_TIERS + 2) >   > > +struct memory_tier { > + struct list_head list; > + struct device dev; > + nodemask_t nodelist; > + int rank; > +}; > + I suggest to use two data structure, struct memory_tier { struct list_head list; nodemask_t nodelist; int rank; }; struct memory_tier_dev { struct list_head list; struct device dev; struct memory_tier *tier; }; Then we can put struct memory_tier here and still hide struct memory_tier_dev in memory_tiers.c. In this way, we don't need to force all struct memory_tier users to compile the entire driver core headers. And we can separate the user space interface implementation from the other part of the kernel. >  extern bool numa_demotion_enabled; >  int node_create_and_set_memory_tier(int node, int tier); >  int next_demotion_node(int node); >  int node_set_memory_tier(int node, int tier); >  int node_get_memory_tier_id(int node); >  int node_reset_memory_tier(int node, int tier); > +struct memory_tier *node_get_memory_tier(int node); > +void node_put_memory_tier(struct memory_tier *memtier); I don't find caller of these 2 functions in series. Can we remove these functions? Best Regards, Huang, Ying [snip]