Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2677545iof; Wed, 8 Jun 2022 09:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvIqqztCITj6CA2fhWpiIGTWaqJ9p9sXtkmM4UjKMVNSkJ6YtMF16D1A5kAkgeu8hs+KYa X-Received: by 2002:a17:902:f682:b0:164:3d5:74c1 with SMTP id l2-20020a170902f68200b0016403d574c1mr35484282plg.60.1654706599368; Wed, 08 Jun 2022 09:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654706599; cv=none; d=google.com; s=arc-20160816; b=CRiXDKBvlcZ9kTt42IHvf1ntfF1+egRtrnwbdIE8bbPCSf+d1f5pgHeSVFdLj64gNV /ZpSqIrbM4B5wU5rGL5mgOXI7n/SOgL4bKUm9Yu8DAtz/4lcT4NfSl64gSQm5uyIssVn DCzJ+hnTwrOimz6pQxu18sOJSof6xBw8G9QBd709bU6URLT86TCPrd9YzNyG6OFCT4Vn dtZvrvY6SIYJlbWZqSj+tXHS6ULVb4Twzb9yyskZtiIyRaexPMzJK/aymRnKEw5HOn9+ 3+DcaPzAREytdqLFTRaLWx+SV/P1g9ajP7kEvYNDgLxCb61qaTFnBjU+YV5WmviEVpT9 qvfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=RYpIPpUz753ngwR1UwTc/RTtwIYGK+V+8sLhAcMQujE=; b=VC5wN2XugEpy7XMCIstytl1xYXrrN3s0OR3FsLPiYDu8JkH3SVGZoUJxj8NDFjxwZh Y/4oPGegLo8xO51PZzHl7m98TAL1EQCdYCq/lzOFp56UH1fChn/BALJMylaISpm8Kwcl xdWKYd3iyqTB+1G+XYSKLwVcJblZVJy81Tta8/ww96VZd7zzJWaRekehs8PEBvhhvWZn iMs2AVm5Hb5liE3IPbBWty6D0Pk48UMTUScJBvUfvX2ebtJp71KNYi6lqrBRZHvjXJ67 Kl17RkJC5/tF/0vKkooIO3AgytQv2FMrIZJSMID4jgQjfbqt6evc2M7Kv10YEakPH/Rs 2UNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SvjjZ9PK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lw9-20020a17090b180900b001e675c62e3fsi16153758pjb.71.2022.06.08.09.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SvjjZ9PK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F386F4C7A3; Wed, 8 Jun 2022 09:16:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245257AbiFHQQL (ORCPT + 99 others); Wed, 8 Jun 2022 12:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245263AbiFHQQH (ORCPT ); Wed, 8 Jun 2022 12:16:07 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ED694667C for ; Wed, 8 Jun 2022 09:16:06 -0700 (PDT) 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-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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