From mboxrd@z Thu Jan 1 00:00:00 1970 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 80F98C54ED1 for ; Sat, 24 May 2025 17:32:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 751586B0082; Sat, 24 May 2025 13:32:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 703236B0083; Sat, 24 May 2025 13:32:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6187E6B0085; Sat, 24 May 2025 13:32:42 -0400 (EDT) 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 3FB4E6B0082 for ; Sat, 24 May 2025 13:32:42 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9632AC0995 for ; Sat, 24 May 2025 17:32:41 +0000 (UTC) X-FDA: 83478496122.19.AB2FD19 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) by imf25.hostedemail.com (Postfix) with ESMTP id 4573EA0005 for ; Sat, 24 May 2025 17:32:39 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FNHPtsFe; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748107959; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WROu/pu0ybtezcTtiIfVSav31rQxzPNSRZ+C+QZg8tc=; b=20SsxEgky1MSG3AjHHnq0fn/QyB9yqzh5giDVU+jl6i5TsYZ8xqBydn5mLQtDw32pMN4BS PJlsCb0dC5ZeOMh9VqNpiTG3HTWnwFkSE0yQHf+Ch56Z2XQSnqSWdASIEBH+rnqH8Ke+UK K2NrsMVAoLTu194th3N67tQpopF3oGc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FNHPtsFe; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748107959; a=rsa-sha256; cv=none; b=pveAvybEnO1jKUrrg78Q+nLu0IQtXyQf8HwE+To43quSeXQ6FlAD+IqFypMrol0K2mTAp1 r0lpJQ/CM28Odk69FRVr2imL+ac7a6PP4FzBaVHKeIjq/twizl+52cQbejg7ldrUtWziNL dkBJkn9GPNTq0SS6Zm1wIR2NCOMZLCM= X-Forwarded-Encrypted: i=1; AJvYcCWLIdNwlCfno0M+Q57FtitjpUVJyb5CSCm0XuUu99rAw0lP4JXwTQQr9cHPdOLPJXh8IvDagZjjpw==@kvack.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1748107957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WROu/pu0ybtezcTtiIfVSav31rQxzPNSRZ+C+QZg8tc=; b=FNHPtsFeRX8pTU/7SLHwlK3tfLhI2s2S4yERr4bcbmm2LeCoaIRbUwJ9Io3Ks45f2l5d2N Ar0u/52+knybSesTclzkHAlTSmxWwwWeKiwXIHMolhRUZyBQV4/z4Ngm1ulvVA8Q0MbLZt wKiE9WPR3dVk3DW85+bRgsILKuLyjxY= X-Gm-Message-State: AOJu0YzgZdJtzyS/EFm647VfBppQP9EL4numKOjqO38U5CNETyPKEdvG /tdJLkLeV0QY6OkGyr+yAomc5FB4ZhF40rlCK9GnTgoiD3HmbItCgLtp5sGlNVadBTluuatpzYl Lo/YlhEZfZFKa9TqM/+logGXEevmmrN4= X-Google-Smtp-Source: AGHT+IHLfzVJ2UpaVUCWlm1zWAshulOa7vscD+okP1uymiyJvIt0gCpGOGxAHvcaNuNdCBxsLb/J5w4FXXuPCngwndM= X-Received: by 2002:a67:e446:0:b0:4e4:3c3a:f163 with SMTP id ada2fe7eead31-4e43c3af25bmr1133636137.7.1748107953734; Sat, 24 May 2025 10:32:33 -0700 (PDT) MIME-Version: 1.0 References: <7ef90a88602ed536be46eba7152ed0d33bad5790.1748002400.git.yu.c.chen@intel.com> In-Reply-To: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt Date: Sat, 24 May 2025 10:32:23 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AX0GCFtAGKYvnyUctUx8VirEg3z97hG3ViBkmzEXKrnSY_iFkoXIYVHb96S8e1c Message-ID: Subject: Re: [PATCH v5 2/2] sched/numa: add statistics of numa balance task To: "Chen, Yu C" Cc: peterz@infradead.org, akpm@linux-foundation.org, mkoutny@suse.com, mingo@redhat.com, tj@kernel.org, hannes@cmpxchg.org, corbet@lwn.net, mgorman@suse.de, mhocko@kernel.org, muchun.song@linux.dev, roman.gushchin@linux.dev, tim.c.chen@intel.com, aubrey.li@intel.com, libo.chen@oracle.com, kprateek.nayak@amd.com, vineethr@linux.ibm.com, venkat88@linux.ibm.com, ayushjai@amd.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yu.chen.surf@foxmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4573EA0005 X-Stat-Signature: fy7pwacpnadpsmwumai77tu7cepzkyfz X-Rspam-User: X-HE-Tag: 1748107959-201973 X-HE-Meta: U2FsdGVkX18fFkNLuMhv66mFm/q7YOtIdDTwX7v4jVnOXs9Uhqi/zFt9v0pNBY0Zw6jVhVy2wAOgWuqfXoxkv1V2psssdbo2kqyunaAsLkNYPcrAdRtCjYX6cSYnc2s3kFhkIjMj1Fgobf0f8iBDnpHUllDvMHf0Whju/8uEYvO7IKKvTGe6DLjEXb48e4fHYLt5JPc/oFLhtV5LRVT832LtARWpWpy2Wc9/xGakKP0IjSDxBmasVAGcGr6cITUEz9Ib1+7eAe7p3MrIjKDjTMVgO7tgCZZUr/kH6GrAZj7K23efYWOqlSO7Mp5qDX0lOuN0gMGmVcdqOPEYc51VOwt+tizZg58D75wdWVFOMP2sAXrXitFpRcw45aqUwBHcwGQxvpbiICrM8cQ/3bJxs5uVLJeAMIf6xoXwfnKEF6cO2KvgYEcwW3SI+kNxbtjQfyugg50kVOO9Xpx8gjvFOi2bm9dWyPzRJkq6jnmAnh9L57qPwGoJ04aufc0tmd3hPUOfOjwqjlooZ54arPA+N0PISpVymYn9vbzOqNRBNhKfNOMYM3cepfOJBVAj0RlqXhFrZFFJXO+ZOYBHKy8WH1u0y1XrxgtbBmv+SzdVOTi9W/jdY+wy1x6cgFfshlpn6k2u9Ti9QfP3EL+FzfC7YnWr3w03/XYtbqMXQyintHc13Zjyk1u54Ym4lJWtnxV6H4yjA/7RsBclMMQFdzZVQ1Oh+zhuyMkWwuf1Lwo59cMjZIItyZgvIfzmiT6FSlRbYxCIxmoYa9MHR5i443pVEdeWU17ib0hptjzvGSCnYgoSX/15Pa1nit4dOEB05ariZQtAxHYulzfTbwA3BTAkOKHAVtUaucYflE1QTxWY1+Vozkzfc8MKvYaR++sFqraQubaHYbSI7Pq2mDeF0vS8QyGxScVrLvuL587haJN8n4o87EoGFryyXcmx2aXpETFNV4EXA39vVsHeCpiDGkC JBOOxJAb a938YS7Ki1lvLwQOht0QAr8u0k8Qs2KtYZYMWQPcwtfallsIr1W2jJNs8pKIO3vtY5fn8RCEPIDKKv2uXmO9RJlqMd+GpPJ/UT9eHbHDFoMDK+IEiHlQ4gtsWaP6PZ57BXYOMevEZUgTuZXxoEJ2KA+QaWQFKvBEw7dAhYI/1/s3kw9AsTMiyxi+ZNgyOMwVMkh3OLmxYegLbCT4= 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: On Sat, May 24, 2025 at 2:07=E2=80=AFAM Chen, Yu C wr= ote: > > Hi Shakeel, > > On 5/24/2025 7:42 AM, Shakeel Butt wrote: > > On Fri, May 23, 2025 at 08:51:15PM +0800, Chen Yu wrote: > >> On systems with NUMA balancing enabled, it has been found > >> that tracking task activities resulting from NUMA balancing > >> is beneficial. NUMA balancing employs two mechanisms for task > >> migration: one is to migrate a task to an idle CPU within its > >> preferred node, and the other is to swap tasks located on > >> different nodes when they are on each other's preferred nodes. > >> > >> The kernel already provides NUMA page migration statistics in > >> /sys/fs/cgroup/mytest/memory.stat and /proc/{PID}/sched. However, > >> it lacks statistics regarding task migration and swapping. > >> Therefore, relevant counts for task migration and swapping should > >> be added. > >> > >> The following two new fields: > >> > >> numa_task_migrated > >> numa_task_swapped > >> > >> will be shown in /sys/fs/cgroup/{GROUP}/memory.stat, /proc/{PID}/sched > >> and /proc/vmstat > > > > Hmm these are scheduler events, how are these relevant to memory cgroup > > or vmstat? > > Any reason to not expose these in cpu.stat? > > > > I understand that in theory they are scheduling activities. > The reason for including these statistics here was mainly that > I assumed there is a close relationship between page migration > and task migration in Numa Balance. Specifically, task migration > is triggered when page migration fails. > Placing these statistics closer to the existing Numa Balance page > statistics in /sys/fs/cgroup/{GROUP}/memory.stat and /proc/vmstat > may help users query relevant data from a single file, avoiding > the need to search through scattered files. > Notably, these events are associated with a task=E2=80=99s working set > (footprint) rather than pure CPU cycles IMO. I took a look at > the cpu_cfs_stat_show() for cpu.stat, it seems that a lot of > code is needed if we want to expose them in cpu.stat, while > reusing existing interface of count_memcg_event_mm() is simpler. Let me address two of your points first: (1) cpu.stat currently contains cpu cycles stats. I don't see an issue adding these new events in it as you can see memory.stat exposes stats and events as well. (2) You can still use count_memcg_event_mm() and related infra while exposing the stats/events in cpu.stat. Now your point on having related stats within a single interface is more convincing. Let me ask you couple of simple questions: I am not well versed with numa migration, can you expand a bit more on these two events (numa_task_migrated & numa_task_swapped)? How are these related to numa memory migration? You mentioned these events happen on page migration failure, can you please give an end-to-end flow/story of all these events happening on a timeline. Beside that, do you think there might be some other scheduling events (maybe unrelated to numa balancing) which might be suitable for memory.stat? Basically I am trying to find if having sched events in memory.stat be an exception for numa balancing or more general. thanks, Shakeel