From patchwork Fri Dec 8 09:06:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 13485038 X-Patchwork-Delegate: paul@paul-moore.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E/DRJ7vk" Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A82A10F1; Fri, 8 Dec 2023 01:06:43 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d0aaa979f0so14208615ad.0; Fri, 08 Dec 2023 01:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702026403; x=1702631203; 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=5FXGf9L1hz/wQQ/jUv0sNTidQzM378s4gfN4y5IQE/M=; b=E/DRJ7vkip0DXH3MTqZgLBRkgyu0Qx4wHpAM+PElVOLu1lPYAXxtQsc7u5FRMFItFT qXWTj3+uPOkQ3CaNMT1JX4meGzRSWBjyKXOKU05iW5PhKCuU+C6SWPzukc2+03pDTFiz lnZJeQmD389wGMJrBh1ZyVRVfdBV6G6k4sN1X4gimkgOcGpHcz6W68IL8bRyt5ysquJr GAXVPzPYmJpOsQ53nSfRs4FCPBjoidKCyq31HwkrtFeKO6JEZYarDDwaGhb21nI1tb4c TDGP4cpEWNbMYxRMFsRnByE2g4Pg20kPF2JrQzyWZawWOyFJ/Ga49TdKh+4ilHUI9VBO nwDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702026403; x=1702631203; 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=5FXGf9L1hz/wQQ/jUv0sNTidQzM378s4gfN4y5IQE/M=; b=PHgZsZhx2ABYpSR+VTs++mDI3EfSs/50+F2zqTy3ubm9pJ2G42/piebhLUhRhdlmxP A5hPZ/YKE17+ZJ+wEImZKpUHtGGbtm45110xFgjEB8qMnHUXM5Vfi6QOHCnkxuJZyTUm K38jayU+7oc0nIKHFkI7TtfyawfqNiE6Z7WYQ+vGR8PCzG4vMLMxXyWc3bfVEXaVTLSP 5o6z9NADIBXYZRbGQmDhWV/R8XQcTq+KPcrFdTtmTHbvNzGq/hpzfFX5HdEPl8OhAVFh rZl+5xK0EjxmRyIeXt/8wkE/AeYWJFJEN3jB+aClL3VokpGk7eXJ59UXN9YPcj5NCKEE 8j2Q== X-Gm-Message-State: AOJu0YySqD2QWS2YuYY+ZQC60LvjN0q0kGL/2xN6pvGafCXe82XVaJVA n4cz5zwUPQMrKTvulakp0Ni0CciJSFNnb43S1D0= X-Google-Smtp-Source: AGHT+IFlw/JLS1hN3T0ahEP+Fd1/GMCS9LQMI06Z1/BK/WYt8tyi7FPO5YKhxacr/lJxGfNAdtearg== X-Received: by 2002:a17:903:22cb:b0:1d0:a7b7:74b7 with SMTP id y11-20020a17090322cb00b001d0a7b774b7mr3612483plg.104.1702026402988; Fri, 08 Dec 2023 01:06:42 -0800 (PST) Received: from vultr.guest ([2001:19f0:ac00:4055:5400:4ff:fead:3bd0]) by smtp.gmail.com with ESMTPSA id 21-20020a170902ee5500b001d057080022sm1188173plo.20.2023.12.08.01.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 01:06:42 -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 Subject: [PATCH v4 1/5] mm, doc: Add doc for MPOL_F_NUMA_BALANCING Date: Fri, 8 Dec 2023 09:06:18 +0000 Message-Id: <20231208090622.4309-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231208090622.4309-1-laoar.shao@gmail.com> References: <20231208090622.4309-1-laoar.shao@gmail.com> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The document on MPOL_F_NUMA_BALANCING was missed in the initial commit The MPOL_F_NUMA_BALANCING document was inadvertently omitted from the initial commit bda420b98505 ("numa balancing: migrate on fault among multiple bound nodes") Let's ensure its inclusion. Signed-off-by: Yafang Shao Reviewed-by: "Huang, Ying" --- .../admin-guide/mm/numa_memory_policy.rst | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst index eca38fa..19071b71 100644 --- a/Documentation/admin-guide/mm/numa_memory_policy.rst +++ b/Documentation/admin-guide/mm/numa_memory_policy.rst @@ -332,6 +332,33 @@ MPOL_F_RELATIVE_NODES MPOL_PREFERRED policies that were created with an empty nodemask (local allocation). +MPOL_F_NUMA_BALANCING (since Linux 5.12) + When operating in MPOL_BIND mode, enables NUMA balancing for tasks, + contingent upon kernel support. This feature optimizes page + placement within the confines of the specified memory binding + policy. The addition of the MPOL_F_NUMA_BALANCING flag augments the + control mechanism for NUMA balancing: + + - The sysctl knob numa_balancing governs global activation or + deactivation of NUMA balancing. + + - Even if sysctl numa_balancing is enabled, NUMA balancing remains + disabled by default for memory areas or applications utilizing + explicit memory policies. + + - The MPOL_F_NUMA_BALANCING flag facilitates NUMA balancing + activation for applications employing explicit memory policies + (MPOL_BIND). + + This flags enables various optimizations for page placement through + NUMA balancing. For instance, when an application's memory is bound + to multiple nodes (MPOL_BIND), the hint page fault handler attempts + to migrate accessed pages to reduce cross-node access if the + accessing node aligns with the policy nodemask. + + If the flag isn't supported by the kernel, or is used with mode + other than MPOL_BIND, -1 is returned and errno is set to EINVAL. + Memory Policy Reference Counting ================================