Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2804008rdb; Fri, 8 Dec 2023 23:00:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDLnpXBiPS+i1vyuV9k+pfK9fHj3MBUK9kIr+/cWNqPClQ/9+2Qjbw4gYlNhjnVKwbZ6uL X-Received: by 2002:a17:902:bc4c:b0:1d0:91a0:a29 with SMTP id t12-20020a170902bc4c00b001d091a00a29mr784056plz.6.1702105244230; Fri, 08 Dec 2023 23:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702105244; cv=none; d=google.com; s=arc-20160816; b=cjZq2xv3fkitRXzkFgHz+dYoG+3Wp/sMbSnhGWMR3KkYUKjjYE/JOE/O6GP7aV1AbD ydj/UKP8GCGOz+Nl8sG7nqzaOyZUrD3n7HZ2PfeYaHAFOjuzYg38JBcnOtfSsbyceOl8 DiYGzH0YCOA4czlJZQ1aDb9J1ykpAXsWJJEEMiVE14OQ3+pWBqVKbOHr0dviRYVLZl7V YdQNZNaK5BP1nxYU4b5Y7M4UoPCg2zC1W7sbrYg06ZKOTHYvuf5U2TAnHva0Iiex7lb6 ekkzPbgc3Gqn9H87YQb8SOH+56kvh4NNR51IObIeOqTZEL7zz3lY2n0QykZDrED/6Q6B OWrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5fJWjKBdWhZssADuPucbwh57xIICZA8yt0Ti8FZ2CXY=; fh=bKWOhIeOlzy6f8PEUMoNA8u5OXJK2PyAtdTHuDM6h/4=; b=AdH2UGa1U6ZqkSvSIFUjasrYkuqN1UmnCLbUa6CLE3qmYYaGE80kn0aLi+VGSx1j00 2lVN4LJVAvdT4jvKXn5aJkPRFxCdaoByO3VwAMELYlsfM4rJbI/I9FbM2bJECi4yfd/D BqyKanFPBfUpNKIA7V6MZSuvOZfxpBnV/XVFWdcyxDA4HHwrNDzlUhlk9WTXWtwgVXNR l2VVXymHUAmpTR3M0jdglnstRXOvZpFq3JNn6aF+h8Rea5zNRTSET4/LT6gtSbHv0bLX Sf2ZkWqPxbAPlHoyaasYkYrXSIaVHSbM25zsq6JrYol5x5M+tS2MT5kGAwaI3lcFEKaa NCNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JkGhhDNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id be3-20020a170902aa0300b001c5e1c94588si2630621plb.550.2023.12.08.23.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 23:00:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JkGhhDNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id F2AD2808A362; Fri, 8 Dec 2023 23:00:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229441AbjLIHAK (ORCPT + 99 others); Sat, 9 Dec 2023 02:00:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234441AbjLIG7q (ORCPT ); Sat, 9 Dec 2023 01:59:46 -0500 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37FB1994; Fri, 8 Dec 2023 22:59:47 -0800 (PST) Received: by mail-yb1-xb43.google.com with SMTP id 3f1490d57ef6-d9caf5cc948so2900852276.0; Fri, 08 Dec 2023 22:59:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702105187; x=1702709987; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5fJWjKBdWhZssADuPucbwh57xIICZA8yt0Ti8FZ2CXY=; b=JkGhhDNEe7KJuLH8UcKhvnje9xzLzaxjvm4D8RBuCCbsKQU+BFvnoWOG7DJoKCc1oG iU2u/NjEiRP7gU5SLHjx8PBLtwE6BC1S6Vwt8Aqas1Iqhz6EG4sN3V18HZ7F7mc5RmF7 oKeEHBJEPuh2x+3Q9qGMgP55UZHpGHMtPWidqQxIlWyOE84hxQXOMsIOYKmXO/cj1Exn ZCgAmlXMne/M4czLx5UtWOXTfZbPifLxaZGUXiSZtTCrtJwb7ZXCk4KjhAp3gnqCr2Dp bTIGx0Y2NRl25jm6+XD6xSURKKlo+gBsbVVXIqAM99azbOuvzc3uiN+B/VY9cM8ysO3v juoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702105187; x=1702709987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5fJWjKBdWhZssADuPucbwh57xIICZA8yt0Ti8FZ2CXY=; b=xNW3moEE3NmusDVyZPSb4ympSqzl15Il3p5wbaa76HgskamWKndxnuoomGqcZz0xIA omsdTab1SL1RWhs8sXT4oT9P9prRrfjYbkOqhVRb8kbOvMRmOJYXDu6/G/mGKD3ml0NC DDY5ThptZalj7/Y4qFvHNWZhpeeMAc2GDYD0463LSuyGcKYHw8liQy/axYFjrtpJ07cX M0ZI0SILYk9SprQwe/bItikgTlCwSMYSvoTgySouLkeZdPw+4iSV6bm3CUq6zHy0m32/ U1loRiicYGwzEPdFujjvoGKHT1z7aTxENbsvu+Rp83Eunf97gaqFqN7Z4pzQoSiSdfmb F8SA== X-Gm-Message-State: AOJu0Yy5/TZEDS3eZO/90akBJ/3CSIQE9QDYAUwlOSMmjioJOu5tXCFI WAOF2rSgXI4v540eC5xCCQ== X-Received: by 2002:a0d:d48c:0:b0:5d3:e835:bd67 with SMTP id w134-20020a0dd48c000000b005d3e835bd67mr948296ywd.41.1702105186764; Fri, 08 Dec 2023 22:59:46 -0800 (PST) Received: from fedora.mshome.net (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id x8-20020a81b048000000b005df5d592244sm326530ywk.78.2023.12.08.22.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 22:59:46 -0800 (PST) From: Gregory Price X-Google-Original-From: Gregory Price To: linux-mm@kvack.org Cc: linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, arnd@arndb.de, tglx@linutronix.de, luto@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, mhocko@kernel.org, tj@kernel.org, ying.huang@intel.com, gregory.price@memverge.com, corbet@lwn.net, rakie.kim@sk.com, hyeongtak.ji@sk.com, honggyu.kim@sk.com, vtavarespetr@micron.com, peterz@infradead.org, jgroves@micron.com, ravis.opensrc@micron.com, sthanneeru@micron.com, emirakhur@micron.com, Hasan.Maruf@amd.com, seungjun.ha@samsung.com Subject: [PATCH v2 06/11] mm/mempolicy: allow home_node to be set by mpol_new Date: Sat, 9 Dec 2023 01:59:26 -0500 Message-Id: <20231209065931.3458-7-gregory.price@memverge.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231209065931.3458-1-gregory.price@memverge.com> References: <20231209065931.3458-1-gregory.price@memverge.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 08 Dec 2023 23:00:41 -0800 (PST) This patch adds the plumbing into mpol_new() to allow the argument structure's home_node field to set mempolicy home node. The syscall sys_set_mempolicy_home_node was added to allow a home node to be registered for a vma. For set_mempolicy2 and mbind2 syscalls, it would be useful to add this as an extension to allow the user to submit a fully formed mempolicy configuration in a single call, rather than require multiple calls to configure a mempolicy. This will become particularly useful if/when pidfd interfaces to change process mempolicies from outside the task appear, as each call to change the mempolicy does an atomic swap of that policy in the task, rather than mutate the policy. Signed-off-by: Gregory Price --- mm/mempolicy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index ce5b7963e9b5..446167dcebdc 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -308,6 +308,7 @@ static struct mempolicy *mpol_new(struct mempolicy_args *args) policy->flags = flags; policy->home_node = NUMA_NO_NODE; policy->wil.cur_weight = 0; + policy->home_node = args->home_node; return policy; } @@ -1621,6 +1622,7 @@ static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask, args.mode = lmode; args.mode_flags = mode_flags; args.policy_nodes = &nodes; + args.home_node = NUMA_NO_NODE; return do_set_mempolicy(&args); } @@ -2980,6 +2982,8 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) margs.mode = mpol->mode; margs.mode_flags = mpol->flags; margs.policy_nodes = &mpol->w.user_nodemask; + margs.home_node = NUMA_NO_NODE; + /* contextualize the tmpfs mount point mempolicy to this file */ npol = mpol_new(&margs); if (IS_ERR(npol)) @@ -3138,6 +3142,7 @@ void __init numa_policy_init(void) memset(&args, 0, sizeof(args)); args.mode = MPOL_INTERLEAVE; args.policy_nodes = &interleave_nodes; + args.home_node = NUMA_NO_NODE; if (do_set_mempolicy(&args)) pr_err("%s: interleaving failed\n", __func__); @@ -3152,6 +3157,7 @@ void numa_default_policy(void) memset(&args, 0, sizeof(args)); args.mode = MPOL_DEFAULT; + args.home_node = NUMA_NO_NODE; do_set_mempolicy(&args); } @@ -3274,6 +3280,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) margs.mode = mode; margs.mode_flags = mode_flags; margs.policy_nodes = &nodes; + margs.home_node = NUMA_NO_NODE; + new = mpol_new(&margs); if (IS_ERR(new)) goto out; -- 2.39.1