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 56744C00144 for ; Fri, 29 Jul 2022 07:22:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1FD56B0071; Fri, 29 Jul 2022 03:22:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CFE68E0001; Fri, 29 Jul 2022 03:22:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848D56B0073; Fri, 29 Jul 2022 03:22:40 -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 7524F6B0071 for ; Fri, 29 Jul 2022 03:22:40 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4BB4F1A119E for ; Fri, 29 Jul 2022 07:22:40 +0000 (UTC) X-FDA: 79739294880.02.82A206D Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf06.hostedemail.com (Postfix) with ESMTP id D4A721800AC for ; Fri, 29 Jul 2022 07:22:39 +0000 (UTC) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26T7DOA4037697; Fri, 29 Jul 2022 07:22:24 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=DBM5ySA5g0r2dZVDe9Jwxay5z+uFtZLDHYvlpDeRg/Q=; b=r/ZS29FLP/JGCEO5L1tQs7Ac+nCxbUned4WyKqVHy3b/xv+Y/qLIJDRWfi/8ShltFqVv qgTl3Iz4Kg4C4812GTQE2SmEUZwe1BgEV+5bv1mU+i/Ur3CYKNdp6BYLLSlh4ULgCvGL QBoD2qDVPTMHqMTXJdUy+5wN6QB5orciOpJ3tAARJltnMb/+rrW4SloRFetTQpNOsKX6 S5Yaq8CNs5eF0h4w2AWeDPl1iWw13cFVnNyrP90AjzmPH7lvRcZhtxfcTtYBtvwk0cO2 HjzoCaBJzlri9C2UZ/CnsJYboDIgWw2MBqQs74dXrJ8y42Q/u3d2Sq88BMiA4MGYHmSG vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hmaydr90u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 07:22:24 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26T7GFeU012876; Fri, 29 Jul 2022 07:22:23 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 3hmaydr90j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 07:22:23 +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 26T7Jrnp015895; Fri, 29 Jul 2022 07:22:22 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma02dal.us.ibm.com with ESMTP id 3hhfpj9ssp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 07:22:22 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26T7ML7V43647244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Jul 2022 07:22:21 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B5EDBE053; Fri, 29 Jul 2022 07:22:21 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1F97BE04F; Fri, 29 Jul 2022 07:22:15 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.86.244]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 29 Jul 2022 07:22:15 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" 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 Subject: Re: [PATCH v11 5/8] mm/demotion: Build demotion targets based on explicit memory tiers In-Reply-To: <87wnbwl92w.fsf@yhuang6-desk2.ccr.corp.intel.com> References: <20220728190436.858458-1-aneesh.kumar@linux.ibm.com> <20220728190436.858458-6-aneesh.kumar@linux.ibm.com> <87wnbwl92w.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Fri, 29 Jul 2022 12:52:13 +0530 Message-ID: <878rocs7ru.fsf@linux.ibm.com> Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KySSwqCNwEFSknFiAkUe-GNaF_tB5zpE X-Proofpoint-ORIG-GUID: 3pSJE4HUNA2SUiCpfZHrZ5uJlvdE6lwe 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.122.1 definitions=2022-07-28_06,2022-07-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207290028 ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="r/ZS29FL"; spf=pass (imf06.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659079359; a=rsa-sha256; cv=none; b=ELA5Yto74eIZAez8m/TrA5uJwiNpQQpZd+khjDzdx9bHHHNIm2pN2EdaUEoNc7ffkyrJNO PLMmUyLHACYtbTZoS0H1qHCHmQMUiGxYJ4eiS1qKPrtJEtA2kPjKIW8WgwvhBdMPbg8J+a 5A8cp6hplhIQXiZKbXfv3xFAJc93nDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659079359; 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=DBM5ySA5g0r2dZVDe9Jwxay5z+uFtZLDHYvlpDeRg/Q=; b=wkHa4sQJw530ccFzUl7ARpzGwQ2M/6W3wGMPdjgCqjfZhbvCvEmmjPwrlCnOJCkubog1TD GkinU0kWJLM1F9gMWafbjxkpznef3/UM3x6iMrVuAa5v6kC2fy/sfs1xjGmP5v6Ki+CWx4 7qxOBnZeKaUAZcctmb1/XZTBMMWq9kw= X-Rspamd-Server: rspam10 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="r/ZS29FL"; spf=pass (imf06.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Stat-Signature: jqwqzx4sizwq37fyf3uhn858dpi7zgqr X-Rspamd-Queue-Id: D4A721800AC X-HE-Tag: 1659079359-177338 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: "Huang, Ying" writes: > "Aneesh Kumar K.V" writes: > + */ .... >> +int next_demotion_node(int node) >> +{ >> + struct demotion_nodes *nd; >> + int target; >> + >> + if (!node_demotion) >> + return NUMA_NO_NODE; >> + >> + nd = &node_demotion[node]; >> + >> + /* >> + * node_demotion[] is updated without excluding this >> + * function from running. >> + * >> + * Make sure to use RCU over entire code blocks if >> + * node_demotion[] reads need to be consistent. >> + */ >> + rcu_read_lock(); >> + /* >> + * If there are multiple target nodes, just select one >> + * target node randomly. >> + * >> + * In addition, we can also use round-robin to select >> + * target node, but we should introduce another variable >> + * for node_demotion[] to record last selected target node, >> + * that may cause cache ping-pong due to the changing of >> + * last target node. Or introducing per-cpu data to avoid >> + * caching issue, which seems more complicated. So selecting >> + * target node randomly seems better until now. >> + */ >> + target = node_random(&nd->preferred); > > Don't find code to optimize node_random() for weight == 1 case, forget > to do that? I guess you suggested to do that as the patch for node_random or did I got the review feedback wrong? https://lore.kernel.org/linux-mm/87y1wdn30p.fsf@yhuang6-desk2.ccr.corp.intel.com The change for node_random will be patch outside this series. -aneesh