Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp198849rdd; Wed, 22 Nov 2023 13:14:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXaO5ms3tnELC2vE3JlEmWyIPqayN4lGv9yvolq+JsJGjq/D++dzs4Lpr+x/3LtN+wWvnf X-Received: by 2002:a05:6e02:1d07:b0:35b:b6b:8ae7 with SMTP id i7-20020a056e021d0700b0035b0b6b8ae7mr4299988ila.5.1700687664464; Wed, 22 Nov 2023 13:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700687664; cv=none; d=google.com; s=arc-20160816; b=IUwYWoeL3RRTP4jm7k7Z4HgeV8b835wDDKeCsgmfhovzTN1vs9qSonaEkvk6ViRkxJ 9hqjd90VAh8HVL3rq2DdzUreTgjDabIrYjlNfQdFeFi3XfQU+E0hVZr8VUF9aDG41NkK JuMkUwroHVrCahrnd+69pe5Ias3AM9bM1nXVJHWDchmClDNaASFiQO7Z9tbHLJADJY7d 2nV3vEe1AiGuhu1NPB91pQChPr1s60lv6Wkvg5YrVVWCAwigLwc2vq5Ned9Bjx5YruiG X6+Z58dFRVGuTgWGNL+6dBxmof9k5i1c8+jzN82PfhxhLYn6NXKZ6bf5oZ+JdOTDHott noIg== 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=Ytb+zLJCPBPTeP+HrayDkCJaJ1nmZr7MUC/QCQp0Rn8=; fh=oGSAV5gRGUhpxAQmPPuhXynNS/gQQ/xIjVhrkaeHVfk=; b=JaRYVMDJhFVbfdQ23nWoeS8la4L845lwGEoEXPFuQrfNWu0ZvgPEr1MxZGx49e5Eh7 Y3tsd6l9UgPt7TuxCusdYsVJpjjj58fz7tIf78UxzMpOwM8bzleYOV0RfX263WSGL5Nj lXw529Zt2dGPRD7C0MhmPXd7VkA5yHP+QnIriff+zrxPVU+rM8NMQeb0HDH2rI1qVUX9 IZcJFfLp/KnPxiYjsxeYdWUXOMa382vizgo5M6h0mVtNiBp8OiueB6jfatSyWEZ0HvF0 LOgAQJNls6YS2uo/pYNn8UnLwC7jZjoT02wKBMRoJdnJZArWwFoBNcAqvSmBuywpBchc u3XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VpCN+Rfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a16-20020a056a000c9000b006c4fc8585c8si318540pfv.364.2023.11.22.13.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 13:14:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VpCN+Rfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id B93538218E5D; Wed, 22 Nov 2023 13:13:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344683AbjKVVNB (ORCPT + 99 others); Wed, 22 Nov 2023 16:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344589AbjKVVMl (ORCPT ); Wed, 22 Nov 2023 16:12:41 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D4BD41; Wed, 22 Nov 2023 13:12:30 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id d2e1a72fcca58-6cbc8199a2aso239284b3a.1; Wed, 22 Nov 2023 13:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700687549; x=1701292349; 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=Ytb+zLJCPBPTeP+HrayDkCJaJ1nmZr7MUC/QCQp0Rn8=; b=VpCN+Rfz0k6df6KdgOAJqVdlwGCL1xYt1DbAqiyLKtIAYGBNWAK15OaSgKlYHaA9Td td8PdKQiHXmAL06x0fNiErR4d6Szu/1UZ2+OlPyAyEhpDiZBWFDCLWX3QM3/01UHGY4U R6QBcTJSHgv6nzzVNcofnNXOqwnYGDEpdD8sYhCqUC8Wb0UzHFkVcwQR/TFZ7hPDMpZG 3Va2OjxEAJcij/mAOO4qfIbtZIHjm5i7qnVgPtQ0bs/x+X2AJJKSPdi5m32l0rwAoW/f prtc8LNNI9ycudrLBrTUFS7ekI1M7FVgzxpHqmLQ7Z6AllzKaIVYBKBvcS0A1cOI7wQP qR4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700687549; x=1701292349; 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=Ytb+zLJCPBPTeP+HrayDkCJaJ1nmZr7MUC/QCQp0Rn8=; b=JMoUL41RiZlMAAb3sA77J/hR6zHnPnZ0BlcFDqnSxLUg6vaPTVN7YTX4i+XICBYRK/ 2SyDGbJZP+R62sgQzurlBUbg96Y3xB4jH3lJSbM1H83w0xz1d7e+eH+YAI37tYJVsD4I o9BzYUdxdmgtG5ZhT2wBHNlPtdcpxAQGPvMxEO/4J97WNna/izw/JwQuSirnwpROwisF bnbREmviswuwxHfFS4kQBt6eFUDS7WPOwB5NdIdSYgvzyYU8RYYyuiSolM6uFmJ6GdoQ 236nPG6MOmMfZmuP3na4UKh/CsPa8Ge3CWi790ruhMZNHmIpdCy4baWS1ZBQ1KMwrSvv mFmg== X-Gm-Message-State: AOJu0YyxjEzyfYiRI1j0aJOtfgQUQHnVfzofq2bhEURK4rVJwBjMx84p 05p6jwPxjcukmOuQBtqkQw== X-Received: by 2002:a05:6a20:3d8f:b0:18b:37b4:e4e7 with SMTP id s15-20020a056a203d8f00b0018b37b4e4e7mr3025618pzi.39.1700687549206; Wed, 22 Nov 2023 13:12:29 -0800 (PST) Received: from fedora.mshome.net ([75.167.214.230]) by smtp.gmail.com with ESMTPSA id j18-20020a635512000000b005bdbce6818esm132136pgb.30.2023.11.22.13.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 13:12:28 -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 Subject: [RFC PATCH 08/11] mm/mempolicy: export replace_mempolicy for use by procfs Date: Wed, 22 Nov 2023 16:11:57 -0500 Message-Id: <20231122211200.31620-9-gregory.price@memverge.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231122211200.31620-1-gregory.price@memverge.com> References: <20231122211200.31620-1-gregory.price@memverge.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 13:13:09 -0800 (PST) We will be adding a /proc/pid/mempolicy entry for use in swapping the mempolicy of a process at runtime. Export replace_mempolicy so that this can be used by that interface. Signed-off-by: Gregory Price --- include/linux/mempolicy.h | 9 +++++++++ mm/mempolicy.c | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 931b118336f4..b951e96a53ce 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -177,6 +177,8 @@ static inline bool mpol_is_preferred_many(struct mempolicy *pol) extern bool apply_policy_zone(struct mempolicy *policy, enum zone_type zone); +extern long replace_mempolicy(struct task_struct *task, struct mempolicy *new, + nodemask_t *nodes); #else struct mempolicy {}; @@ -297,5 +299,12 @@ static inline bool mpol_is_preferred_many(struct mempolicy *pol) return false; } +static inline long replace_mempolicy(struct task_struct *task, + struct mempolicy *new, + nodemask_t *nodes) +{ + return -ENODEV; +} + #endif /* CONFIG_NUMA */ #endif diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fb295ade8ad7..e0c9127571dd 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -815,9 +815,8 @@ static int mbind_range(struct vma_iterator *vmi, struct vm_area_struct *vma, } /* Attempt to replace mempolicy, release the old one if successful */ -static long replace_mempolicy(struct task_struct *task, - struct mempolicy *new, - nodemask_t *nodes) +long replace_mempolicy(struct task_struct *task, struct mempolicy *new, + nodemask_t *nodes) { struct mempolicy *old = NULL; NODEMASK_SCRATCH(scratch); -- 2.39.1