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 9215CC19F2D for ; Tue, 9 Aug 2022 05:41:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16E788E0001; Tue, 9 Aug 2022 01:41:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F7AC6B0072; Tue, 9 Aug 2022 01:41:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB2F98E0001; Tue, 9 Aug 2022 01:41:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D55A26B0071 for ; Tue, 9 Aug 2022 01:41:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9FB2380E21 for ; Tue, 9 Aug 2022 05:41:39 +0000 (UTC) X-FDA: 79778957118.03.19D3149 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf14.hostedemail.com (Postfix) with ESMTP id 22853100168 for ; Tue, 9 Aug 2022 05:41:38 +0000 (UTC) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2794obfn036061; Tue, 9 Aug 2022 05:41:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=WkIbFEOkPmK9UE8789KKdSs/NYWfyLh4YmkPmJENNzk=; b=myF+xfhHDnSqitw7HdwxaCypTL0ZtH/I7zVOcsP+Aihhi7Ba+GDxpNrur1p6nHaXEIVK cSQoJrvQa71IitIdI+vnx150Sn3R/3iCeaFnP4UCUYdehOdLa3EXgxiSJYcW91tggXtP B2z/LexF2wrgBDXrgkx8e/ZZAiDJI88XsFF37BMw462NcjgasnVR59oZJlJNiQ1gzG/R 0ELQsCz31PTeX3jNpuTiZSs5certKz8KJ+gS6tMQCwQNgfEBXS2HHglofBbKC5eYfF+5 L0XvMneoDSvzfVF6KyCO0i2z6dYvIk82BrCGHYGs6fSNXd3WUQyNR9gurMydXbt4r9nE 0A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hugwph7kt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Aug 2022 05:41:26 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2794tlRF009940; Tue, 9 Aug 2022 05:41:25 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hugwph7k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Aug 2022 05:41:25 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2795b8tm029421; Tue, 9 Aug 2022 05:41:23 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3hu4rp8n0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Aug 2022 05:41:23 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2795fK9j26149144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Aug 2022 05:41:20 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1F4CAE04D; Tue, 9 Aug 2022 05:41:20 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D978EAE045; Tue, 9 Aug 2022 05:41:16 +0000 (GMT) Received: from [9.109.205.170] (unknown [9.109.205.170]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Aug 2022 05:41:16 +0000 (GMT) Message-ID: Date: Tue, 9 Aug 2022 11:11:15 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v13 6/9] mm/demotion: Add pg_data_t member to track node memory tier details Content-Language: en-US To: "Huang, Ying" Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Wei Xu , Yang Shi , Davidlohr Bueso , Tim C Chen , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Johannes Weiner , jvgediya.oss@gmail.com References: <20220808062601.836025-1-aneesh.kumar@linux.ibm.com> <20220808062601.836025-7-aneesh.kumar@linux.ibm.com> <87bksugfex.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Aneesh Kumar K V In-Reply-To: <87bksugfex.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uUA-OyQIaDlI8_E4PCctLJX_yhkN7Kca X-Proofpoint-GUID: yYCoDjjhtkS2ON-eZC172paZ_oNBD07e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-08_14,2022-08-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 phishscore=0 suspectscore=0 priorityscore=1501 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2208090023 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660023699; a=rsa-sha256; cv=none; b=KrcBUMUllye7kIdTkLLXuncfCe9g9UdExjHnfqOnbUT3DWnUkci8jamgAlE+sp7oka8Yo4 VQfOQEUeEsINnQSzye6aDK98l38+bb/XY0hRwD3lYqSiCEImDdAz3VJrxUL3lKX+Nv8wgl dJWAa8NnSSH1cHVeJlAyr+4qFlgUL7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660023699; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WkIbFEOkPmK9UE8789KKdSs/NYWfyLh4YmkPmJENNzk=; b=WTPi099yplFAvBrjwGkOCdZOfuHKQpXBACOoYRmZJ62/1X4k6F2gOlLhslqQxo4mYJ/7Wk iHxqvS5DbP5Pw3Dwg2LPvsdGAiofzNFldIAcfuZuYtgb3X9QrxBYmz6ZtuW5/h6bkmXwAp E2i8IvFRKfDGIpdMB8LwdEL0/TIzmKU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=myF+xfhH; spf=pass (imf14.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Stat-Signature: bxifo6xjreurzg59ci8kwhdojb1ah8rj X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 22853100168 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=myF+xfhH; spf=pass (imf14.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-HE-Tag: 1660023698-507035 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 8/9/22 10:51 AM, Huang, Ying wrote: > "Aneesh Kumar K.V" writes: > >> 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 happen under an rcu read lock or memory_tier_lock. >> >> Signed-off-by: Aneesh Kumar K.V >> --- >> include/linux/mmzone.h | 3 +++ >> mm/memory-tiers.c | 38 ++++++++++++++++++++++++++++++++------ >> 2 files changed, 35 insertions(+), 6 deletions(-) >> >> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h >> index aab70355d64f..353812495a70 100644 >> --- a/include/linux/mmzone.h >> +++ b/include/linux/mmzone.h >> @@ -928,6 +928,9 @@ typedef struct pglist_data { >> /* Per-node vmstats */ >> struct per_cpu_nodestat __percpu *per_cpu_nodestats; >> atomic_long_t vm_stat[NR_VM_NODE_STAT_ITEMS]; >> +#ifdef CONFIG_NUMA >> + struct memory_tier __rcu *memtier; >> +#endif >> } pg_data_t; >> >> #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) >> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c >> index 02e514e87d5c..3778ac6a44a1 100644 >> --- a/mm/memory-tiers.c >> +++ b/mm/memory-tiers.c >> @@ -5,6 +5,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> #include "internal.h" >> @@ -137,12 +138,18 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty >> >> static struct memory_tier *__node_get_memory_tier(int node) >> { >> - struct memory_dev_type *memtype; >> + pg_data_t *pgdat; >> >> - memtype = node_memory_types[node]; >> - if (memtype && node_isset(node, memtype->nodes)) >> - return memtype->memtier; >> - return NULL; > > After adding pgdat->memtier, it appears there's unnecessary to keep > memtype->memtier? > It do simplify find_create_memory_tier() where I use if (memtype->memtier) to check whether the memtype is already added to a memory tier. I could switch that to list_empty(memtype->tier_sibiling). But I felt the current one is much cleaner . -aneesh