From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68E8723E342 for ; Mon, 16 Mar 2026 02:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773629676; cv=none; b=DDMgfVS//dvJNglCPmu/dxmOfV3VgEHjjUkL3O41F+OIgPiZBFBuqjpwQx86JA1TaEbSleC0Gam+n6O4pFuG8BzMmRQeXpd9orEgxb1SZmJ7laVp6t0QzUvcK9Xzo01d8kPYHFzGR4i/m+hPvOWLnkNF07aJz5Gwn8GTZigr1GI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773629676; c=relaxed/simple; bh=czmgvKSkWorSh1qUwUlivcTnGg2JfzlR8yJGfiNC2IU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=n2LjpCVUqadISzV17HjlyyDCv6EN59I2b+nih5MqcqYJbqu7bHURhJQXuNASrGDnqE6n3d+AJ0mqtB0Wd+CBLVtJrt/D7ATm7danqw5IhV4A4qtc8OOYuhZ/f8yBOqjS0S4ZfX9gQsaJGeWwA2Co+AxgR2GfdahWNgg09sNnU1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=l9BePq72; arc=none smtp.client-ip=115.124.30.110 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="l9BePq72" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1773629672; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=czmgvKSkWorSh1qUwUlivcTnGg2JfzlR8yJGfiNC2IU=; b=l9BePq72YgYdFv4VFjHvyMKOxAqh5RE6Cw7UN9xHkpU/NQIe0SfTSj/8lWSyIsqL22O7pmpU7JKqxQj6QDlsAz2kYH1/b27TNkBvN5HLQuXugp+weIX1wJSatqBSlwm16gqvFioCRIoZc2rF9Ru4VOE1Key0WhJNwmWDmFN3BCc= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=ying.huang@linux.alibaba.com;NM=1;PH=DS;RN=33;SR=0;TI=SMTPD_---0X.-KIlz_1773629668; Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0X.-KIlz_1773629668 cluster:ay36) by smtp.aliyun-inc.com; Mon, 16 Mar 2026 10:54:30 +0800 From: "Huang, Ying" To: "JP Kobryn (Meta)" Cc: "Vlastimil Babka (SUSE)" , linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com, apopple@nvidia.com, axelrasmussen@google.com, byungchul@sk.com, cgroups@vger.kernel.org, david@kernel.org, eperezma@redhat.com, gourry@gourry.net, jasowang@redhat.com, hannes@cmpxchg.org, joshua.hahnjy@gmail.com, Liam.Howlett@oracle.com, linux-kernel@vger.kernel.org, lorenzo.stoakes@oracle.com, matthew.brost@intel.com, mst@redhat.com, rppt@kernel.org, muchun.song@linux.dev, zhengqi.arch@bytedance.com, rakie.kim@sk.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, surenb@google.com, virtualization@lists.linux.dev, weixugc@google.com, xuanzhuo@linux.alibaba.com, yuanchu@google.com, ziy@nvidia.com, kernel-team@meta.com Subject: Re: [PATCH v2] mm/mempolicy: track page allocations per mempolicy In-Reply-To: (JP Kobryn's message of "Fri, 13 Mar 2026 11:09:58 -0700") References: <20260307045520.247998-1-jp.kobryn@linux.dev> <3a42463b-9ddd-4d64-b64c-6c2e6e4fc75d@kernel.org> <343bbd5b-67a0-46c4-8ec4-69158bf26b3f@linux.dev> <874imkpba1.fsf@DESKTOP-5N7EMDA> <60f71f4c-71d9-4751-8c6b-10179b98bef0@kernel.org> Date: Mon, 16 Mar 2026 10:54:26 +0800 Message-ID: <87sea0o55p.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii "JP Kobryn (Meta)" writes: > On 3/13/26 12:34 AM, Vlastimil Babka (SUSE) wrote: >> On 3/13/26 07:14, JP Kobryn (Meta) wrote: >>> On 3/12/26 10:07 PM, Huang, Ying wrote: >>>> "JP Kobryn (Meta)" writes: >>>> >>>>> On 3/12/26 6:40 AM, Vlastimil Babka (SUSE) wrote: >>>>> >>>>> How about I change from per-policy hit/miss/foreign triplets to a single >>>>> aggregated policy triplet (i.e. just 3 new counters which account for >>>>> all policies)? They would follow the same hit/miss/foreign semantics >>>>> already proposed (visible in quoted text above). This would still >>>>> provide the otherwise missing signal of whether policy-driven >>>>> allocations to a node are intentional or fallback. >>>>> >>>>> Note that I am also planning on moving the stats off of the memcg so the >>>>> 3 new counters will be global per-node in response to similar feedback. >>>> >>>> Emm, what's the difference between these newly added counters and the >>>> existing numa_hit/miss/foreign counters? >>> >>> The existing counters don't account for node masks in the policies that >>> make use of them. An allocation can land on a node in the mask and still >>> be considered a miss because it wasn't the preferred node. >> That sounds like we could just a new counter e.g. numa_hit_preferred >> and >> adjust definitions accordingly? Or some other variant that fills the gap? > > It's an interesting thought. Looking into these existing counters more, > the in-kernel direct node allocations, which don't fall under any > mempolicy, are also included in these stats. One good example might be > include/linux/skbuff.h, where __dev_alloc_pages() calls > alloc_pages_node_noprof(NUMA_NO_NODE, ...) which eventually reaches > zone_statistics() and increments the stats. IIUC, the default memory policy is used here, that is, MPOL_LOCAL. > So if we applied the hit/miss/foreign semantics in this patch to the > existing counters we would be mixing allocations that are in and out > of policy, losing the accuracy. > > The new 3 counters I last proposed (in an effort to reduce the amount of > new counters as much as possible) would isolate mempolicy allocs and be > named to reflect that: numa_mpol_{hit,miss,foreign}. --- Best Regards, Huang, Ying