From patchwork Wed Nov 22 14:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 13464937 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 2A380C61D97 for ; Wed, 22 Nov 2023 14:16:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FB146B0615; Wed, 22 Nov 2023 09:16:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A6E96B0616; Wed, 22 Nov 2023 09:16:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 823016B0617; Wed, 22 Nov 2023 09:16:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6D50A6B0615 for ; Wed, 22 Nov 2023 09:16:24 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4D034400B0 for ; Wed, 22 Nov 2023 14:16:24 +0000 (UTC) X-FDA: 81485790288.03.CA22899 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf19.hostedemail.com (Postfix) with ESMTP id 406651A0025 for ; Wed, 22 Nov 2023 14:16:20 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="WB4/PkmK"; spf=pass (imf19.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700662581; a=rsa-sha256; cv=none; b=cVVoElGw6pc7LPpdatrnS5unSN9p3BtNeGEZPHNA6yejxHGgL9Lb2h0C0Zz+WjEqcEnPnP UKeUMPCRZjzY0dkYxgIohh0KdOMkGrYHucXT5bj1s5s+HXTcF9IlgPicuLlehpgcUKvzA+ F2yec+D9kZVGowyFN4V9PA2fj7Qia6M= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="WB4/PkmK"; spf=pass (imf19.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.169 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=1700662581; 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=wEKF8LLG6U3WOQ+0Jd5b+JaDhInk2g16roqp0OT/5iQ=; b=ampgsZEZ/L/RM/cf1+e5L7vOTGuTEM8ELP29m6SAmCezgoI97nhi6108e6uX8hjCP6WtgP mVMgtq2IaYL0Z6/BTUICdbOMyShJpz/yMTd8TLCEZrm68L1FBXG9H6Gsh4RGPYsiECBc/S 06QYvGYA0OiKBYMKiYmXXo0wVx5YBsw= Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6b5cac99cfdso5931580b3a.2 for ; Wed, 22 Nov 2023 06:16:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700662580; x=1701267380; 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=wEKF8LLG6U3WOQ+0Jd5b+JaDhInk2g16roqp0OT/5iQ=; b=WB4/PkmK4QAi54ca5ZQCUWyBCxsqcdLQNEpABUU5Hh+CPoMbKwPL/HesE5uO89VLeV n0mbzmmqG0/7CbW4NSKxcocNBrFQOV0OJXWE5ir5UJ2wTKYM3Bz/woTZkIwHIL+h1UOn hvKV2bD3dG6EANgAg6RmgYuUeshH9VMzKP+6sXRMakB6BlJkhaFIVD9IFVdi1fPkb6eH 1G80NsD0e1ioGMONQPq7PmusWC92jAf0Ys2/8lYgUssZA4IGNfUJZZheGDzjaLKWltag pScQ0WAGWBK1r3TXCJ7ZLWFTNkd8/pT0LrqIhMCD8Sakr67ZrQXZyrkx8M16eVAzIJWY OHbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700662580; x=1701267380; 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=wEKF8LLG6U3WOQ+0Jd5b+JaDhInk2g16roqp0OT/5iQ=; b=pMNtKFRmFdo2gT5djg7ST2TUqmiBw2EwboAlKTufSYkAcmKxZWTdcxz/eMyAujttIz 5jhFcUN/itcTXN3c7Pcz2GmByV9FZbskhUNdL2X+EcuCJHVQqAWfNswHTq6Mx2Jgy3Q8 XeQsqGKkmr6cbZz7AtFeByRVAtKgp28LVZOAv8XNbp0wmvwdrwfkVHP55AKajoGr5S/2 WzO4S5F0WUNfTWpZVr18hrUP0mMZjHY9iNyl9Aj6puin4OeK2oeIzDeK3XbFP96Z6XlN W0eAGb2yYR2M24lB3XLZQVvaTkYV+fQ4oNAQ04Bp0gj23OlVPp97uEioe6VB4+n+HT27 IwfQ== X-Gm-Message-State: AOJu0Yw6fgLPpPI2pk0pFqW8tCnNWclD+Ld86X0CQlKEriyZLPZ9PvG+ 1NkDOb9DWjTXFKPNB/wEDExFoJCrTUgZdQfX X-Google-Smtp-Source: AGHT+IHaW2MTTY6XpXzARVPEMKHa87mJ8Yxq3K7qITmUxY6o2gfygIc8izDK27aA06ZWTKsysRRh+w== X-Received: by 2002:a05:6a20:e126:b0:187:7917:189d with SMTP id kr38-20020a056a20e12600b001877917189dmr2568042pzb.29.1700662579836; Wed, 22 Nov 2023 06:16:19 -0800 (PST) Received: from vultr.guest ([2001:19f0:ac01:a71:5400:4ff:fea8:5687]) by smtp.gmail.com with ESMTPSA id p18-20020a63fe12000000b0058988954686sm9356260pgh.90.2023.11.22.06.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 06:16:19 -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 Cc: linux-mm@kvack.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, ligang.bdlg@bytedance.com, Yafang Shao , "Huang, Ying" Subject: [RFC PATCH v2 1/6] mm, doc: Add doc for MPOL_F_NUMA_BALANCING Date: Wed, 22 Nov 2023 14:15:54 +0000 Message-Id: <20231122141559.4228-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231122141559.4228-1-laoar.shao@gmail.com> References: <20231122141559.4228-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 406651A0025 X-Stat-Signature: rtji9w436z8xnwh7snctsbwpr1qk6uqz X-Rspam-User: X-HE-Tag: 1700662580-67076 X-HE-Meta: U2FsdGVkX1+/GPorCj1OWakPGb33b86VZdXhO9F28goiPQ6g44kew/2boKIMUpRi7IF2LodKawVF+CxLC0ZjS0Nk60S29MqITc7s5hzxT5UAtNxvZPaMOSfWRaCIeYZdKUKsJY/qTNSrwDASr8sWXNqGY6RglvilKwg0IlRNKWV4Db5c0DDN4M6B3gea4u7DSVAa4AWnAlQEncGxc9c3TX4UG4Iq8trAWQRkcq/UzH9erRyZQoINWZ3VHp8UequfA6ziUdYuWeosMkUtYxa3scTeIUjKqwR00GIBlixhVrNGJ8cUDoeJMJPAezZ8tWXpejr0j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gsly98e2wgQ2dRizRdMaCH/V1i+VrDr+VNuc5kSV8WB+kyKv5zrJtsALX7ft/ExBSyS4pJ/HKDFtIA1gLaTvZVIH5aQYMcMKZIicMx02hVF7XlmUcOAgnMCrLni49Zf2gQnQZ9BTDSowL8mTX1d498bzsxKiI7cxdLi4VTJ4yGR8Jbl3LhMHRJp2OZVBaP2lvOSzn5+6UxQw6Mp70rN5VdPFlU6lTS9XH13ZhQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000024, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Cc: "Huang, Ying" 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 eca38fa81e0f..19071b71979c 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 ================================