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 EF404C43334 for ; Tue, 21 Jun 2022 04:19:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 780778E0001; Tue, 21 Jun 2022 00:19:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 709576B0073; Tue, 21 Jun 2022 00:19:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 582678E0001; Tue, 21 Jun 2022 00:19:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 456226B0072 for ; Tue, 21 Jun 2022 00:19:17 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 1B743802CC for ; Tue, 21 Jun 2022 04:19:17 +0000 (UTC) X-FDA: 79600938354.21.243C997 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf17.hostedemail.com (Postfix) with ESMTP id 3F9624001A for ; Tue, 21 Jun 2022 04:19:16 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25L3gD4m032278; Tue, 21 Jun 2022 04:19:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : content-type : mime-version; s=pp1; bh=hwOBoY5qFMEfFMRZbs9LOCT/B/V2y64Uzzn/r8yUL5A=; b=hUp3uFMbfV+/Mewg3VXKziIPVel6PY/K85X2H8dJidALUkVPc+cyS2vC6j6UZqClwRg6 Bf41KA8ytYxPP/s4zIZirseShiT00Ke5dRyz6y6aGcf4fajhjBW/MyuSXNOF3aEvqMBX o1L+0lBB7UTfKA26pb/jHpCGLN0ykdnqud0o3busrIMj/laYxejNmkyIjNsf4wsSWKZ+ YRlFhVcNqi4lk23ASaK1ACxunwa0E7fSenFFfbhk11RQc2o9NlvmYYw3Y12olNiracXH 26RWJAYQXHLMLA/3ZDc3eUijhIiZjsTgc8FyBGiyRNmFa3JHbO1rEtPlpjWVzNuKWc3x Kw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gu6ae0p4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 04:19:03 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 25L4J3RI014203; Tue, 21 Jun 2022 04:19:03 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gu6ae0p4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 04:19:03 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25L49wxs004428; Tue, 21 Jun 2022 04:19:01 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02dal.us.ibm.com with ESMTP id 3gt008wrnv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 04:19:01 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25L4J1xi9634402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jun 2022 04:19:01 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8228AC060; Tue, 21 Jun 2022 04:19:00 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5462DAC059; Tue, 21 Jun 2022 04:18:53 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.109.205.170]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 21 Jun 2022 04:18:53 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Tim Chen , linux-mm@kvack.org, akpm@linux-foundation.org Cc: Tim Chen , Wei Xu , Huang Ying , Greg Thelen , Yang Shi , Davidlohr Bueso , 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 , Shakeel Butt Subject: Re: [RFC PATCH 1/3] mm/memory-tiers Add functions for tier memory usage in a cgroup In-Reply-To: <94a10c772c50d378b81dad654476551bfc50e3d7.1655242024.git.tim.c.chen@linux.intel.com> References: <94a10c772c50d378b81dad654476551bfc50e3d7.1655242024.git.tim.c.chen@linux.intel.com> Date: Tue, 21 Jun 2022 09:48:50 +0530 Message-ID: <875ykuabth.fsf@linux.ibm.com> Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: _2_iRA_8FO38nrjsJSbRM4ZfVDQEZ7Ly X-Proofpoint-GUID: k5MDrmGV_hKijexuBAQBpBWw9EOMkmVE 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.883,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-21_02,2022-06-17_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206210015 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655785156; a=rsa-sha256; cv=none; b=xbKM3uz4Ro3lQDDjL+XKHZSqlV8uQB5vPCkjSGw5HQGCUjOAqJPmojUxgIayFdszTDXKKA gjpWitq6UX+dLaYCGylnyJuUhuGBNh2Z0xvjd547YtMi3QHzwMskPhNUk1Fdp8WVnhLkEx dK/dYCqPnaFdk2jLYt2VLpqhY/vTyQo= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hUp3uFMb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf17.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655785156; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hwOBoY5qFMEfFMRZbs9LOCT/B/V2y64Uzzn/r8yUL5A=; b=M7pcvvyxjF0oycHFCU/kneFVcTnwhaJZHge62BKKDRTCE9OwDRbAl0K9cZSysiAoeLLMtx lyTAk14vYDVAme2n+q8Jk2amxE+3+y6s39BoGxjFZRwdeqL33PnE4wep+/9HlFdrm+ZPjM xUtOTqR7Q6AANq/svXw9u3LFm8LqhRc= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3F9624001A X-Stat-Signature: nn15imzqxyueygm1oaqcwoegiyezp9kk X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hUp3uFMb; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf17.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-HE-Tag: 1655785156-802661 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: Tim Chen writes: +unsigned long mem_cgroup_toptier_usage(struct mem_cgroup *memcg) > +{ > + struct memory_tier *top_tier; > + > + top_tier = list_first_entry(&memory_tiers, struct memory_tier, list); > + if (top_tier) > + return mem_cgroup_memtier_usage(memcg, top_tier); > + else > + return 0; > +} As discussed here, we would want to consider all memory tiers that got compute as top tier. https://lore.kernel.org/linux-mm/11f94e0c50f17f4a6a2f974cb69a1ae72853e2be.camel@intel.com V6 patchset actually walk the full memory tier hierarchy reverse and consider any memory tier with higher or equal rank value than the first memory tier with CPU as top tier. https://lore.kernel.org/linux-mm/20220610135229.182859-12-aneesh.kumar@linux.ibm.com -aneesh