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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C757C43334 for ; Tue, 7 Jun 2022 20:16:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E50B36B0074; Tue, 7 Jun 2022 16:16:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD96F6B0078; Tue, 7 Jun 2022 16:16:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9F536B007B; Tue, 7 Jun 2022 16:16:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B97076B0074 for ; Tue, 7 Jun 2022 16:16:05 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 88029356D9 for ; Tue, 7 Jun 2022 20:16:05 +0000 (UTC) X-FDA: 79552546290.06.183FB0C Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf21.hostedemail.com (Postfix) with ESMTP id 397111C0073 for ; Tue, 7 Jun 2022 20:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654632962; x=1686168962; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=FPcIftRj6V6O6B26UF70MyNErLXGhjWNb6LX0nAvIH0=; b=Ih+Yy1PYheSdoB2mmFoad8xGs1fljzj5YkeEVs/i3cbBeGPJaKpVwkFm WDQaVjrYL5EQVm59BrfR4zr8cazBoyrCea7IGJvuUX4kxOebmrXB4AYGx R7PBfDrURzJbbXh2QC+R7RYBDWTsLkPEK1xkf5nO/z5ql2WtjNSpNm6d6 hLb2nMo3apIcdMJZ0mbpG0DKiibowwq5xO0vIDVIgqWyVnXKY5IiJYhVO d4ZcQEE46eHUkfUx3uvdslwyVTfoY8znMk5fTOnoL5TivXSbxTBA1r6jT VkfHI1F4rc2xxXQtjtnx1x+IQgdJRhdkbR2HrurboO4CQETwauWwAf0Xx A==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="259732403" X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="259732403" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 13:16:00 -0700 X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="584375949" Received: from schen9-mobl.amr.corp.intel.com ([10.251.8.166]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 13:15:59 -0700 Message-ID: Subject: Re: [PATCH v5 2/9] mm/demotion: Expose per node memory tier to sysfs From: Tim Chen To: "Aneesh Kumar K.V" , linux-mm@kvack.org, akpm@linux-foundation.org Cc: Wei Xu , Huang Ying , 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: Tue, 07 Jun 2022 13:15:59 -0700 In-Reply-To: <20220603134237.131362-3-aneesh.kumar@linux.ibm.com> References: <20220603134237.131362-1-aneesh.kumar@linux.ibm.com> <20220603134237.131362-3-aneesh.kumar@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Stat-Signature: cszopf817kyhxceo18ndh573ftgpw7jm Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Ih+Yy1PY; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf21.hostedemail.com: domain of tim.c.chen@linux.intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=tim.c.chen@linux.intel.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 397111C0073 X-HE-Tag: 1654632961-371172 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, 2022-06-03 at 19:12 +0530, Aneesh Kumar K.V wrote: > > > +static struct memory_tier *__node_get_memory_tier(int node) > +{ > + struct memory_tier *memtier; > + > + list_for_each_entry(memtier, &memory_tiers, list) { We could need to map node to mem_tier quite often, if we need to account memory usage at tier level. It will be more efficient to have a pointer from node (pgdat) to memtier rather than doing a search through the list. > + if (node_isset(node, memtier->nodelist)) > + return memtier; > + } > + return NULL; > +} > + > Tim