Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1006197rdb; Mon, 19 Feb 2024 00:36:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWHAain+op1UaDw8ngqYd9RSmY/zQ+OfvBO6d8izOAqn/ZPcuyw7f8+UGgF9sOPd0wuDtFHoh/kiz7QHQNVM/L0sXumUoRs8pfUiAw+/Q== X-Google-Smtp-Source: AGHT+IFYqeM5pfbNAffhvCoC1yH2f7YAnzAYwusOa0tFAW7TJ4Ix/4rjTSupcFMetEwOnZIA3WUJ X-Received: by 2002:a05:6a20:9f4e:b0:19e:c34a:6fa8 with SMTP id ml14-20020a056a209f4e00b0019ec34a6fa8mr9061372pzb.45.1708331767663; Mon, 19 Feb 2024 00:36:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708331767; cv=pass; d=google.com; s=arc-20160816; b=pdMbo/qGW1+htNecKsmHZaB2e3+cF8qcMWmJUDMkJNhep6mpo0XRw5NeONrziSaF6/ APDu+IHJ27F9W2EaVhXteQv6QORYZpmZybtaQS+Du5oBODoBsK0vZbvnBgUbd4a/6CAe NLV5lui4USuP/zDEkTi2HkyVXS8f6lf36YwRz4/+RJDaqvCJtKQDgJXs4gud4qFBxSOM i4bi/WztNd+PnYfgny766Q6rFbzkS0EfqlMfAK37o42FpIFhz7e4I4/eF/Xi26T982WD DsHl8Z1mvNPehEv1U7ZPJ0NNYVoodRd0JlnhplX9zXrUi1HG8VPC+Df2P8wWgXW/b+8x ETvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=W+DlIcgGzAZl3NaBK8gp9F/M4NDAB6yQAnUg1uqgJSI=; fh=JvhTOd0Gwh/DgZ4krMBgjdWzIlpP3nGjhF12PXdn86U=; b=CK3EHhrP9/NLemwL7t7uYuJWAHY/tETPcjEsFOSkduJA7lYhgQy9Uyxhu/YQXZzrNj vWUf46Ei/HhRgnKn0d8R68+hiRMZkz8F7hL8rEQRhe6CjfpTQXyQKJ9KcaJnhxV38bz6 5BFZ9WvrlRtGJSlb7rRF2P3sE15AHVOizBkBifn9KJcqLN+YBPYsqsL3OjaEzOq0XPPg PtqZu0wLakEDzr9dMimFFm+Lxm39215AMwPtJgKj94hf2Y7HL/5RsjZgXOXb+90Yi4dc v8VGyo9gLjVi0uMeTIcxeH1KYNCwg98EfDoFHigdr0hqXKqjr/C/740LkjOT/sksFliz 04Kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="jk6S1oc/"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-70940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t1-20020a17090ad50100b002969fb734fbsi4134110pju.66.2024.02.19.00.36.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:36:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="jk6S1oc/"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-70940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5BBE3282088 for ; Mon, 19 Feb 2024 08:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0821B1D69D; Mon, 19 Feb 2024 08:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jk6S1oc/" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91351224C9 for ; Mon, 19 Feb 2024 08:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708331748; cv=none; b=P2TVF1TdM1VnkKYnRuuiwLZwX4Yo/rVBdY8A3Iv+Ti4ACCv382e5DKUHUXjRxrLsvx66yS070uL6hweNPKrnzMxLfeOVc5UtSwMaQnXvNOZANiywF/kLiyxvcGJO0NshfCUmNkqb37HSJhPW+xcghNeHBna9lLqT23v98FtkfnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708331748; c=relaxed/simple; bh=BRI+jBcPAJ6HgLYpoJx6rbmANXx2dSqiqZs/tVZfAwU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CyAJLJk21brSWWh++5UYxbyrgrYuqvThd6YYrUgl+XVTf2xawnKE6+mcgEo/nlRrSwhqtNMEQxEjRE2ZEHQnyDLE2+SvL2lQdgWVgAFSSYjvRfbW116IQPgYoQ0r2sFJovvLB2W6HKUYGmZEJLiOXHJF3KF9cSSyQUKmcrwXVgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=jk6S1oc/; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41J7HrJ1015351; Mon, 19 Feb 2024 08:34:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=W+DlIcgGzAZl3NaBK8gp9F/M4NDAB6yQAnUg1uqgJSI=; b=jk6S1oc/QppIW6bPUVZqW+zCfehnok3b3tO+XA+2KUPSXxX4nvuu4dpi2KRs01XNT+CJ FudN5AUUrh99QYip96lO11F5GxHkQ7bu0vU3nJhXz+HSjBCPZBfthQu8isqGYFGY4ojQ dTNGz+9uhUFw/x3oLVzCqWGNbKyZQnp3rHU5QZy6YjwUwExdoJZvZzNDsjuaSbeSwZF5 8uT5CK6Vp2bo/ujFazaaOaWQ9iYvM9FBVKVESTLAVjKsnsxqBlm01mJjEsAMPU47DYk0 b5xOwK8f3OeV8RIwSRBpFstCWfQypOEBG1LKAqfpC3vMY4LC3LLu5k3xWF629DO28IT0 oQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wb3w79juj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Feb 2024 08:34:42 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41J8B5xS023389; Mon, 19 Feb 2024 08:34:41 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wb3w79jub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Feb 2024 08:34:41 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41J6UYcZ031118; Mon, 19 Feb 2024 08:34:40 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9bkfktg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Feb 2024 08:34:40 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41J8Ybll21037570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Feb 2024 08:34:40 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA0D458064; Mon, 19 Feb 2024 08:34:37 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3802758066; Mon, 19 Feb 2024 08:34:30 +0000 (GMT) Received: from [9.109.245.191] (unknown [9.109.245.191]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 19 Feb 2024 08:34:29 +0000 (GMT) Message-ID: <63a0f7c4-3c3f-4097-9a24-d1e3fc7b6030@linux.ibm.com> Date: Mon, 19 Feb 2024 14:04:23 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] mm/mempolicy: Use the already fetched local variable Content-Language: en-US To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Aneesh Kumar , Huang Ying , Dave Hansen , Mel Gorman , Ben Widawsky , Feng Tang , Michal Hocko , Andrea Arcangeli , Peter Zijlstra , Ingo Molnar , Rik van Riel , Johannes Weiner , Matthew Wilcox , Mike Kravetz , Vlastimil Babka , Dan Williams , Hugh Dickins , Kefeng Wang , Suren Baghdasaryan References: <9c3f7b743477560d1c5b12b8c111a584a2cc92ee.1708097962.git.donettom@linux.ibm.com> <20240218133851.22c22b55460e866a099be5ce@linux-foundation.org> From: Donet Tom In-Reply-To: <20240218133851.22c22b55460e866a099be5ce@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: JdZqDiB5eVcS1JeYf3jBi_8uBg7XTy8o X-Proofpoint-GUID: VtJweGyLEc8FaQ0QA9ztAUpcNFKPxVNa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-19_05,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 phishscore=0 suspectscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402190063 On 2/19/24 03:08, Andrew Morton wrote: > On Sat, 17 Feb 2024 01:31:33 -0600 Donet Tom wrote: > >> Avoid doing a per cpu read and use the local variable thisnid. IMHO >> this also makes the code more readable. >> >> ... >> >> --- a/mm/mempolicy.c >> +++ b/mm/mempolicy.c >> @@ -2526,7 +2526,7 @@ int mpol_misplaced(struct folio *folio, struct vm_area_struct *vma, >> if (node_isset(curnid, pol->nodes)) >> goto out; >> z = first_zones_zonelist( >> - node_zonelist(numa_node_id(), GFP_HIGHUSER), >> + node_zonelist(thisnid, GFP_HIGHUSER), >> gfp_zone(GFP_HIGHUSER), >> &pol->nodes); >> polnid = zone_to_nid(z->zone); > int thisnid = cpu_to_node(thiscpu); > > Is there any dofference between numa_node_id() and > cpu_to_node(raw_smp_processor_id())? And it it explicable that we're > using one here and not the other? Hi Andrew Both numa_node_id() and cpu_to_node(raw_smp_processor_id()) return the current execution node id, Since the current execution node is already fetched at the beginning (thisnid) we can reuse it instead of getting it again. Thanks Donet Tom >