Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1459252rdb; Mon, 19 Feb 2024 17:21:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXTCZBU+PUQASRY+nYZozjKL5MQ/FtUH+7e+22Stb89Rm/M7fscx2E1AU+Oh6/KYmTcj7bW9DZYs1T2Jvf+7NabbA8UO1mmWGaekN0Rrg== X-Google-Smtp-Source: AGHT+IGnLGviXq4BqKmwiHADoZfJg4JeV+qtPSMmI1GkQnK7nDGCI2xAIfLrGRnaXBK3NDgbvSgL X-Received: by 2002:a17:90a:c706:b0:297:4f1:8a19 with SMTP id o6-20020a17090ac70600b0029704f18a19mr11869196pjt.23.1708392106375; Mon, 19 Feb 2024 17:21:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708392106; cv=pass; d=google.com; s=arc-20160816; b=leWJdEjQfN7JnpABQypUOxUdbDOHWRN1xT083pQW0Olwaane105i6dL2aNyRVPfEQy tMkA5yc7eJ9QCQOUkoVixUGQ3T+l/F+MlM34uYQEYp2Lcneb5r0SeXuvU8A4h2FRqQwX qBLsOZEjEi0WpXZR+UEH2UEUKFDXHlFu0kmOBdm3NwNCJNJedKfBJ9gLcfhsIAC5rjBV k3aA7K+zjxja9qjsUBoXK0Yw+v4jiOUZL8iVWZ0DSE3F0MwmAnNygVxp7//wwN+MFonD 7MT2SZseo4HrgZi5dcKFmpFAODLp9fwDC9YgwHWTnqfsRuDU7XYB5PDQjEujukrTHTV+ yKdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=e5KE/sOpoBpJdNiHcU6KzuMERh9okMkNERwe2ujCL4w=; fh=oaJILGMyl8AgouPFjkU6vrw2ixmffovi74Fp5oMqWcA=; b=e/W3cmdDTAe1h8JIagWsMzk24XRTZMmws3GUtEuKp4/iTqE1x81GMQ2GlMttaJGJFW K97h4DczP49lf1GHHrljCWY/d5Bl+a8M7EyoRXgQARYXlJKrS5SVgHFoT4d722eZ632q bsoHuV5FZSCxEIe0GcwB7ALAAHo7+yyt5ERv48u0JU6hTfjoccxrIcFat9+i65kwRDo5 rP87rKeoPfe8AV+1jq4+JZVn6jl/arlpfFHAp5undqaj62SsCnmqbmUFPjjzjLR4G22S jEFE4bGLyz2+sUYQo1HbNwKqNjlEtW4oS/oLk8p3kL31rwC/U9mGUWPbMRpc8GpNpngl rHVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="yiMVc/cc"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-72176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72176-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id nv10-20020a17090b1b4a00b00297083e7b7asi5372199pjb.123.2024.02.19.17.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 17:21:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="yiMVc/cc"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-72176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72176-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7283DB20F3E for ; Tue, 20 Feb 2024 01:21:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79F96224E3; Tue, 20 Feb 2024 01:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="yiMVc/cc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6E46022307 for ; Tue, 20 Feb 2024 01:21:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708392092; cv=none; b=gcUlZ3WdoSwfVuecqLS0KwpT6ngSNh0V5sOJj7O5tTsQNyHf2KJUOiHevYWUpNNnNKVNhErwUD2HoXR6ZJlHiVnMkOd8tHjwhAGNOOX/5AiX/5xO6R9cnPasGJRU7YJazcEkw4vj2cOPP78a1icBQfqdtTvrbspIqjbjr7lAM7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708392092; c=relaxed/simple; bh=f+LPJ3IkItGv4h0sbqHYTpkIh+AiELeDo8BUNQvdob8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=edfQjisWbXKvP7nMp2SRnOTkYaJZ/jrV8dMNHGLy1nKrJOqqcvpTGixbdGK5h9oRj2GS0p8IBA9NDGKKQO58ax9qR3BbKyxu5Sa5rRyVncxzL1Inxz5/q5puOgJmS1j8eSYe2Bx+g3e2vKdXHAP+zQT7oftthreMQBxgjVRGx/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=yiMVc/cc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2ACC433F1; Tue, 20 Feb 2024 01:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708392092; bh=f+LPJ3IkItGv4h0sbqHYTpkIh+AiELeDo8BUNQvdob8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=yiMVc/ccH+/PxpbGZa9TzNl1kxMg8K43yII2wPHR+9K2AWtRnvhstQJn0yX/5Yz3T h/E//Lh7iS0xDFPR7d8WppgRE6jHyAIpCa5KbWFmrUjLpQk+N8eZQE4jBRFB5XSkVM zVwX9+yzepIwDqIoeeqiHR4M6ZWgAj+stTYsQG+Y= Date: Mon, 19 Feb 2024 17:21:30 -0800 From: Andrew Morton To: Donet Tom 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 Subject: Re: [PATCH 1/3] mm/mempolicy: Use the already fetched local variable Message-Id: <20240219172130.82a16c1ebecbf8ba86a8987d@linux-foundation.org> In-Reply-To: <63a0f7c4-3c3f-4097-9a24-d1e3fc7b6030@linux.ibm.com> References: <9c3f7b743477560d1c5b12b8c111a584a2cc92ee.1708097962.git.donettom@linux.ibm.com> <20240218133851.22c22b55460e866a099be5ce@linux-foundation.org> <63a0f7c4-3c3f-4097-9a24-d1e3fc7b6030@linux.ibm.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 19 Feb 2024 14:04:23 +0530 Donet Tom wrote: > >> --- 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. Sure, but mine was a broader thought: why do we have both? Is one preferable and if so why?