From patchwork Tue Aug 30 08:14:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12958909 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 4E390ECAAA1 for ; Tue, 30 Aug 2022 08:15:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9549A940008; Tue, 30 Aug 2022 04:15:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 903EB940007; Tue, 30 Aug 2022 04:15:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CBB5940008; Tue, 30 Aug 2022 04:15:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6CDD6940007 for ; Tue, 30 Aug 2022 04:15:24 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3D827120DEE for ; Tue, 30 Aug 2022 08:15:24 +0000 (UTC) X-FDA: 79855549368.12.663E625 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf08.hostedemail.com (Postfix) with ESMTP id 85538160005 for ; Tue, 30 Aug 2022 08:15:23 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27U7wqp1032408; Tue, 30 Aug 2022 08:15:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=Nvw7+EdkkyhknysMScLPafiaExuYZPA4g6Y9MtEHr5M=; b=qlUiuD8Q4Jv10lvMd4u93MQ3B6vjRFqUcbIGxT5LcUDA1K+tot+jcvGwejvd/5y0wN+V yrMoYFioNKQzJ7/hvB7nZx1ihtM5Zlj7Kmb/qlMq3JTeEFXzv4xwecTFPmaJEyrLxLA+ 43lUafnSSCvVNBTuqUYXO/maKutx9gT9MG2bkam73k8LcPcO2LhEdLP862mpVFDU9wP6 0E1Nao9n9ZvIEmiGyz3GSZxKJL0bP1emexkiGzYgQ/Egeb2DU673Wvw9d1wNucedsZQl 4ERpO9quxVRXtIXfOM+HL8ByEzY+g0ZPTxp7xvsWdWqbW+7tYcdKFjUYGROfU16POU3a aA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j9emx8q1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Aug 2022 08:15:12 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27U800uK005045; Tue, 30 Aug 2022 08:15:12 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j9emx8q10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Aug 2022 08:15:11 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27U850md006503; Tue, 30 Aug 2022 08:15:10 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma01dal.us.ibm.com with ESMTP id 3j7aw9pyje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Aug 2022 08:15:10 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27U8F9Cm53543354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Aug 2022 08:15:10 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4A902805A; Tue, 30 Aug 2022 08:15:09 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2CCF28059; Tue, 30 Aug 2022 08:15:03 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.77.247]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 30 Aug 2022 08:15:03 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: Wei Xu , Huang Ying , 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, Bharata B Rao , "Aneesh Kumar K.V" Subject: [PATCH mm-unstable] mm/demotion: Make toptier_distance inclusive upper bound of toptiers Date: Tue, 30 Aug 2022 13:44:57 +0530 Message-Id: <20220830081457.118960-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gXQk2Br2uqwkmmQA3QUipJeTwT080boP X-Proofpoint-ORIG-GUID: WQC1rrHFjpPZSua_uVPsc-G3TLmEbjwV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-30_04,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 mlxscore=0 bulkscore=0 impostorscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208300038 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661847323; a=rsa-sha256; cv=none; b=0T9FRb7pF+Nuw4YCarMXXPwCdlzBRCxPGhCBQjg87feRdA9ZjyyJSRgL0QmGi+xwM4pD8I enFdOj4QuvViWyT2tiXbvQQrjS3KFg3YFhk920BpVxplFpOlwwbYHwY7J993teJArmY3ck O98XX1WtNcinLjYcl9zL3Y2WrloxUZQ= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qlUiuD8Q; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf08.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=1661847323; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Nvw7+EdkkyhknysMScLPafiaExuYZPA4g6Y9MtEHr5M=; b=7pxq4E/rVtnjfidE1H1aY7LedS88CwPTY+O4ibrwg+Y/XJ6gbHTrcHIszoxN8eZJLtDpYL Vi2wLi7ZQUfFFLyjrvTkGQ18dIMV8XxNrWpxuKlwkUy8D+b1N3+fmUtrLus8HPvW9WYuA4 Nmg2czGuqgjgn6kmsu9Ai4pZQnDNLiY= X-Stat-Signature: whrnrnp3jd1we65ashtpmn9mq4buw4of X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 85538160005 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qlUiuD8Q; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf08.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-Rspam-User: X-HE-Tag: 1661847323-226273 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: Based on suggestion from Wei Xu , having an inclusive upper bound is found simpler. Fixes: mm/demotion: Update node_is_toptier to work with memory tiers Signed-off-by: Aneesh Kumar K.V --- mm/memory-tiers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index c4bd6d052a33..c82eb0111383 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -179,7 +179,7 @@ bool node_is_toptier(int node) toptier = true; goto out; } - if (memtier->adistance_start < top_tier_adistance) + if (memtier->adistance_start <= top_tier_adistance) toptier = true; else toptier = false; @@ -361,7 +361,8 @@ static void establish_demotion_targets(void) * abstract distance below the max value of this memtier * is considered toptier. */ - top_tier_adistance = memtier->adistance_start + MEMTIER_CHUNK_SIZE; + top_tier_adistance = memtier->adistance_start + + MEMTIER_CHUNK_SIZE - 1; break; } }