From patchwork Fri Dec 1 09:46:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 13475557 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 20819C07E97 for ; Fri, 1 Dec 2023 09:47:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B3046B0450; Fri, 1 Dec 2023 04:47:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 614676B0452; Fri, 1 Dec 2023 04:47:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 468626B0455; Fri, 1 Dec 2023 04:47:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2E1EB6B0450 for ; Fri, 1 Dec 2023 04:47:18 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 10D59160147 for ; Fri, 1 Dec 2023 09:47:18 +0000 (UTC) X-FDA: 81517771356.11.C303BDD Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf27.hostedemail.com (Postfix) with ESMTP id 20E524001F for ; Fri, 1 Dec 2023 09:47:15 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LkZVKWOm; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701424036; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KGCoJREXvSOAbrJphjZNhFQw16aaUKi1TbhunSAnqyc=; b=sX7cYG+7MeMMRl/DNzQl6iwSMBth+/gcK0T3QWmreSSVBTpVD+eaq1jVefOfCzdnM4wsA8 hBuIhuDcFues9NWPfXgO7OXRtktfrL7QQNMES92yops9YEo97KLu8fRRLCnBlt+b7OWU4k EY0rOSt2zCxADBxP8eYony5IqwYCzs0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701424036; a=rsa-sha256; cv=none; b=cuphSWiq7bdagcjbTGV71DQs3vX8Y05hWjHfNseuB/1x9TfN+CF3AOu8ZHdjJUbWl4f1RY zIRq5XHxKKE6Ivh5eSqtTUeKqvKcBq1j2BCoHBB17XdRzbO2DGi6QXL9EWvaTwmnKHagv1 P6dq1SAaLl5wMiSdh9hBKlxN1Csf+GU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LkZVKWOm; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1cfc34b6890so2631545ad.1 for ; Fri, 01 Dec 2023 01:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701424035; x=1702028835; darn=kvack.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=KGCoJREXvSOAbrJphjZNhFQw16aaUKi1TbhunSAnqyc=; b=LkZVKWOmQDUzX7D293XCxikbpbXi9BTLLDm0w6f9+7wGRZVhROs+Xar3kJNtWSf1ml BN/QUIB6LvP5o9p5k63s52BTxi+26vM8w719HPEl8kHkrRj9PTo+nBlY1gl+tHswzxMK IUdg4q9h/ACNuywYTISVBxzaFEb3Z+WRaxmku3KYDbULzDJc+0PsNHDpB7R0nDlcgtp/ nkeP+HhNPToQVL99jynEdaWSSEl3g9LKEDmsX6EvNXsCEyJWbmIecTCHeqZX2rP3z9uC KUaJWxRtKMFxLzAl0/MrYuRX9HDST6vCnweY9uXqRfeL1JfXGUD5v49KycbpbC95YdZu z48Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701424035; x=1702028835; 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=KGCoJREXvSOAbrJphjZNhFQw16aaUKi1TbhunSAnqyc=; b=G5ilWzfGSuTL8hOednlMAHF11X05TchGLHNLL6PzTAXJvsVgtuebsBP8dhSuC3/JdA zzbv03MRDIScDvcjq0qR3LAiCjOTUSpHW6AWPlIqbztvrSHy8WrgPoamKGNTmSy5BYsd WeYsVCpS/qBShPJ+WQyCrXTZaPjU/d+d5CcjfJ5JsEY3NTY24rLlN9uZbpVdX8AWPCo2 YRDgMWpsPso9xEZs/PSe3hCW+zJRucm/Oo7TKYLgKByj1N3azPHl4lVQqwGV1BjL9Osa cgE82rvvbeNpGK7D6reqX/kL3SasQFIcqBs+KubwElXxJr1/iSdYRUNu1q0CHp0S48jf VQww== X-Gm-Message-State: AOJu0YwLSZHNOrFQnyrS7X9mbbZ1d/RViSQ7gCu8j4pFzaMH2EYcahIX RRrnSfuaIT9kFSfyBDB78es= X-Google-Smtp-Source: AGHT+IGzXU9LrPgZca13IbQFWnu/fiFk9usQfcwA1GinqIP6YmUaY32WZLHTprYh2c8I8vSS8VEDvA== X-Received: by 2002:a17:902:f805:b0:1cf:5806:564f with SMTP id ix5-20020a170902f80500b001cf5806564fmr27316532plb.10.1701424034967; Fri, 01 Dec 2023 01:47:14 -0800 (PST) Received: from vultr.guest ([149.28.194.201]) by smtp.gmail.com with ESMTPSA id e6-20020a170902b78600b001bdd7579b5dsm2875534pls.240.2023.12.01.01.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:47:14 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, omosnace@redhat.com, mhocko@suse.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, ligang.bdlg@bytedance.com, Yafang Shao , Alejandro Colomar , Michael Kerrisk Subject: [PATCH v3 7/7] NOT kernel/man2/mbind.2: Add mode flag MPOL_F_NUMA_BALANCING Date: Fri, 1 Dec 2023 09:46:36 +0000 Message-Id: <20231201094636.19770-8-laoar.shao@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231201094636.19770-1-laoar.shao@gmail.com> References: <20231201094636.19770-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 20E524001F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: bwawoxfmstm1gnq7gbeoyei35y8b7a4x X-HE-Tag: 1701424035-403215 X-HE-Meta: U2FsdGVkX1/lnh/X2h4rfHJPG807fHJAI9lDxIgbwLFR9TCe45zt0KtSnvJAwJB8QLEgnPfz3Pw+1Kb173vkdo2vREZTwtoeMDDZp9nygR7E63cnODj+P5XGe5xWWvFLBjEVnlt8uR2w4D322b1rWR/XIRxwgSXUbGH+ymPIMIyR2UJZz5zaDvjRSj1bzaP7JJoMVs/mD1mw7zCe/2Nx2hPvAmMCy8jl21XSnH2GsRV4s/3pH97eReEK3ZYzibalmzLomYQBjkN9DlOnH7e3EL8RLaoKLCQJvcI68zzN2XMXDZ6JUVwq1J6GwgRlXfUInK1yDNvcb+H6SRLiI6CfpfPQfctFre2rx1tp7bGg8GVt6C2+a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ciUkPxN7BHWccuvKJsPNWUT0u+Vbpc6KhQRoS0SNb/95E41i+kYe5/u3z+yYF7bWIG5qPQzFEa9j43YvG4S7W4W9FIdc1BUdt+iUq9kNmkwFb7MR5Mxgk35dWMs2Skk3z2Q3kAUh7bP4A4whUEMgwHpSPiU0/9uYYNeA64GX+oiReVlsw= 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: List-Subscribe: List-Unsubscribe: In Linux Kernel 5.12, a new mode flag, MPOL_F_NUMA_BALANCING, was added to set_mempolicy() to optimize the page placement among the NUMA nodes with the NUMA balancing mechanism even if the memory of the applications is bound with MPOL_BIND. In Linux Kernel 5.15, this mode flag was extended to mbind(2). Let's also add man-page for mbind(2). It is copied from set_mempoicy(2) man-page with subtle modifications. Related kernel commits: bda420b985054a3badafef23807c4b4fa38a3dff 6d2aec9e123bb9c49cb5c7fc654f25f81e688e8c Signed-off-by: Yafang Shao Cc: "Huang, Ying" Cc: Alejandro Colomar Cc: Michael Kerrisk --- man2/mbind.2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/man2/mbind.2 b/man2/mbind.2 index ba1b81ae9..dac784389 100644 --- a/man2/mbind.2 +++ b/man2/mbind.2 @@ -142,6 +142,23 @@ The supported .I "mode flags" are: .TP +.BR MPOL_F_NUMA_BALANCING " (since Linux 5.15)" +.\" commit bda420b985054a3badafef23807c4b4fa38a3dff +.\" commit 6d2aec9e123bb9c49cb5c7fc654f25f81e688e8c +When +.I mode +is +.BR MPOL_BIND , +enable the kernel NUMA balancing for the task if it is supported by the kernel. +If the flag isn't supported by the kernel, or is used with +.I mode +other than +.BR MPOL_BIND , +\-1 is returned and +.I errno +is set to +.BR EINVAL . +.TP .BR MPOL_F_STATIC_NODES " (since Linux-2.6.26)" A nonempty .I nodemask