From patchwork Tue Jun 25 13:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13711129 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 895AFC3064D for ; Tue, 25 Jun 2024 13:26:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0D266B02DE; Tue, 25 Jun 2024 09:26:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA09D6B02DF; Tue, 25 Jun 2024 09:26:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36656B02E1; Tue, 25 Jun 2024 09:26:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A4F766B02DE for ; Tue, 25 Jun 2024 09:26:24 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4F0FD141825 for ; Tue, 25 Jun 2024 13:26:24 +0000 (UTC) X-FDA: 82269485088.19.63989AA Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf21.hostedemail.com (Postfix) with ESMTP id 86D841C001E for ; Tue, 25 Jun 2024 13:26:21 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Gf6u7xJJ; spf=pass (imf21.hostedemail.com: domain of tursulin@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=tursulin@igalia.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719321970; 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:references:dkim-signature; bh=S/y+Ebptg+FR+X/e86BAmbXdo6Ven/AYl1AyzE9QETw=; b=OexhSDPOc9raboYCQAD7GA6o1D3Q6c/pd7TZsV5eC+yiYPEi8Cxu5fb7KeGMhSLJrpCRRT qZhmy1GFmV1/pJxhB7ld1Cpe/sNqsffF/Nldbemt4ickA8dSgTBY9FncKG73EAPRDzyNGp DQxv16L+Ds8bl3BrEP9DS/BNKTXfh7M= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Gf6u7xJJ; spf=pass (imf21.hostedemail.com: domain of tursulin@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=tursulin@igalia.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719321970; a=rsa-sha256; cv=none; b=XutxObtIzWVQO87bu/o1Yrnoymb3qtPuXNggxA76g/aZyy4hgNXZksV0aLOprndiJB5PWy MJJIox0dxDd33fgj072Lw0rlzWenXPgo+tAmqztMWIoRPa+A4es8x+hbSZYFdW610yQeSi zW+7IKE2D8WU2dx8yPZHBwyw7G1DlsA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=S/y+Ebptg+FR+X/e86BAmbXdo6Ven/AYl1AyzE9QETw=; b=Gf6u7xJJnMS3FEBt0Lo/ATZmrA 9hImBKOD12cISa/0UCwEfZBa+FDuXcj4NdeY6Hd75W2eor49G3XBzx9cmXTfSz6w1rjesiL6EPFQd 6VmhXbJlA9UekcQtCp94cXsE1YmVt1Vo8Z6bfUqjrk2Q/V93a+ZF+BQbiwY7C32b28atl3nt1aRie k6kO6NpNsxbWDJdEdRnY29uILKaN2WJsoLkkhdPmXD3tMIByypW7qA/ibT+7q83/dO5zJRHQhTtIp exos9/n/EZr9KnQxKN5AqHXz597FWgUYJSNypt7wwzCj70U7afCoEsbuwRkkYNuzWd0akYKSv3Q7Z m2iK644g==; Received: from [84.69.19.168] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1sM6BZ-007Jbz-6w; Tue, 25 Jun 2024 15:26:13 +0200 From: Tvrtko Ursulin To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, kernel-dev@igalia.com, Tvrtko Ursulin , Huang Ying , Mel Gorman , Peter Zijlstra , Ingo Molnar , Rik van Riel , Johannes Weiner , "Matthew Wilcox (Oracle)" , Dave Hansen , Andi Kleen , Michal Hocko , David Rientjes Subject: [PATCH] mm/numa_balancing: Teach mpol_to_str about the balancing mode Date: Tue, 25 Jun 2024 14:26:05 +0100 Message-ID: <20240625132605.38428-1-tursulin@igalia.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Stat-Signature: 4r6pmu1znrd35r475zorhxb3fzzqmstc X-Rspam-User: X-Rspamd-Queue-Id: 86D841C001E X-Rspamd-Server: rspam02 X-HE-Tag: 1719321981-360632 X-HE-Meta: U2FsdGVkX19NnqXN67M6jNwMIIz0XrUjtVwiTlJem3S24Takt1owMLELXlVmNPOsc6VEq9GuCwoo36XZVgtMrgEPdIe0Z7PX8NMzAyyiwT6s/33GeZrrYXCmR1Hv0ZreftellfN5JWmO4A+0IpDZf2drAHf0nX7ybICghgtCGBHj+NOEiouLiC3GnVskr/dJ6+zbf2gAXpFV4UbAw1FJJ/Uc1Uvn/P2nuDHnru7W//+7sNBlF03t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W00hVZdPI658OFDZM3K+1lYa4g4vOUn9OwIc7UO33y1pn1i0sIQ8y1zlHLBGCECjAx1DwEGoSA9Msl4SUTAvQJ5rzc4YhDYIMuKEoGSAqJgyg1eD/DuSHjfUlIBJvrCrDyBo0walY659xAlynpuXdrXUOtLikegUpHUMIdQy709ACWUZjq+h+2T/7g4iWY8evKk+odoe2C3MmZZWTyXgbeX98f3p4zDR174pTIDSiNWLr6gK46AsHNTcw= 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: From: Tvrtko Ursulin If a task has had MPOL_F_NUMA_BALANCING set it is useful to show that in procfs. Teach the mpol_to_str helper about its existance and while at it update the comment to account for "weighted interleave" when suggesting a recommended buffer size. Signed-off-by: Tvrtko Ursulin References: bda420b98505 ("numa balancing: migrate on fault among multiple bound nodes") Cc: Huang Ying Cc: Mel Gorman Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Rik van Riel Cc: Johannes Weiner Cc: "Matthew Wilcox (Oracle)" Cc: Dave Hansen Cc: Andi Kleen Cc: Michal Hocko Cc: David Rientjes Reviewed-by: "Huang, Ying" --- mm/mempolicy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index aec756ae5637..d147287c4505 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -3293,8 +3293,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) * @pol: pointer to mempolicy to be formatted * * Convert @pol into a string. If @buffer is too short, truncate the string. - * Recommend a @maxlen of at least 32 for the longest mode, "interleave", the - * longest flag, "relative", and to display at least a few node ids. + * Recommend a @maxlen of at least 42 for the longest mode, "weighted + * interleave", the longest flag, "balancing", and to display at least a few + * node ids. */ void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) { @@ -3331,12 +3332,15 @@ void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) p += snprintf(p, buffer + maxlen - p, "="); /* - * Currently, the only defined flags are mutually exclusive + * The below two flags are mutually exclusive: */ if (flags & MPOL_F_STATIC_NODES) p += snprintf(p, buffer + maxlen - p, "static"); else if (flags & MPOL_F_RELATIVE_NODES) p += snprintf(p, buffer + maxlen - p, "relative"); + + if (flags & MPOL_F_NUMA_BALANCING) + p += snprintf(p, buffer + maxlen - p, "balancing"); } if (!nodes_empty(nodes))