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 DD613C43334 for ; Wed, 8 Jun 2022 16:16:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F0516B0075; Wed, 8 Jun 2022 12:16:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49E846B0078; Wed, 8 Jun 2022 12:16:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33F436B007B; Wed, 8 Jun 2022 12:16:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 24B726B0075 for ; Wed, 8 Jun 2022 12:16:03 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id EF9A0612F5 for ; Wed, 8 Jun 2022 16:16:02 +0000 (UTC) X-FDA: 79555570164.31.321AAB9 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf26.hostedemail.com (Postfix) with ESMTP id 77220140067 for ; Wed, 8 Jun 2022 16:16:02 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 258G46D4008343; Wed, 8 Jun 2022 16:15:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=RYpIPpUz753ngwR1UwTc/RTtwIYGK+V+8sLhAcMQujE=; b=SvjjZ9PKdhaAFOotcQI+aFuTJaVbDHVjcNB6pttvL35mMbB9q2ykMLKsyHVsWFYz4SMC t4CGqcRXHuDM87l/qFjAd9rFoJJ1RxMGnoaJX08H81pp0Hhpllm0aJscebBizr3FGKA7 6GiT5qc4g82S0TNMsEe+QBke+RoqoIdUn53QsXU3az05Mf2zcUVxbsSpUQ4HxPxhiUv5 nR0cV4VVi2oa1zvULZkyCspYJfjq3Q+xZjjGWhhMitw5HG5BK3yCoQm1HSOB5BfUHhGe 7cVnqeBfGfnUKcpt3hpc/UzXcbURmpNsknL/Ak0hY3CGq7Efw3gkYQzx/B2iVM/EaegT bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjvvm3fpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:15:56 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 258FmO75021544; Wed, 8 Jun 2022 16:15:55 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjvvm3fnr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:15:55 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 258Fq88i021798; Wed, 8 Jun 2022 16:15:53 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3gfy19dmx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:15:53 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 258GFqdG22544894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jun 2022 16:15:53 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB02C5204F; Wed, 8 Jun 2022 16:15:50 +0000 (GMT) Received: from [9.43.53.124] (unknown [9.43.53.124]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id CE0705204E; Wed, 8 Jun 2022 16:15:44 +0000 (GMT) Message-ID: Date: Wed, 8 Jun 2022 21:45:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v5 2/9] mm/demotion: Expose per node memory tier to sysfs Content-Language: en-US To: Tim Chen , 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 References: <20220603134237.131362-1-aneesh.kumar@linux.ibm.com> <20220603134237.131362-3-aneesh.kumar@linux.ibm.com> <626023e8-8443-619e-18ee-a758c37fcec2@linux.ibm.com> From: Aneesh Kumar K V In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-GUID: NvDdaqAk1ab3z8KB1xmubNOvHgEMwSU0 X-Proofpoint-ORIG-GUID: uN8Y7nCPra6bmDl1Og_OOyaZNt0yB6M2 Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-08_05,2022-06-07_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 clxscore=1015 spamscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206080066 X-Stat-Signature: pc3we9ndo4zpujoeq6m79xwh5uuxq94m X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=SvjjZ9PK; spf=pass (imf26.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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 77220140067 X-HE-Tag: 1654704962-512350 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 6/8/22 9:36 PM, Tim Chen wrote: > On Wed, 2022-06-08 at 10:25 +0530, Aneesh Kumar K V wrote: >> On 6/8/22 1:45 AM, Tim Chen wrote: >>> 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. >>> >>> >> >> That is something I was actively trying to avoid. Currently all struct >> memory_tier references are with memory_tier_lock mutex held. That >> simplify the locking and reference counting. >> >> As of now we are able to implement all the required interfaces without >> pgdat having pointers to struct memory_tier. We can update pgdat with >> memtier details when we are implementing changes requiring those. We >> could keep additional memtier->dev reference to make sure memory tiers >> are not destroyed while other part of the kernel is referencing the >> same. But IMHO such changes should wait till we have users for the same. >> > > I think we should have an efficient mapping from node to memtier from > the get go. There are many easily envisioned scenarios where > we need to map from node to memtier, which Ying pointed out. > I did an initial implementation here. We need to make sure we can access NODE_DATA()->memtier lockless. Can you review the changes here https://lore.kernel.org/linux-mm/87sfoffcfz.fsf@linux.ibm.com -aneesh