Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2795819rdb; Wed, 4 Oct 2023 11:37:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7hZRETOyMqzA/+j5IIuwLKqZ7qIwG8ap8T1nJyEp+l9DXSc1vWyGk+HmflZnVH0hQTmvq X-Received: by 2002:a17:902:da8b:b0:1c7:8446:d65c with SMTP id j11-20020a170902da8b00b001c78446d65cmr3334226plx.43.1696444667779; Wed, 04 Oct 2023 11:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696444667; cv=none; d=google.com; s=arc-20160816; b=jXFca9kcIhB+K6Ql8WIyIogfRN+bttt1ul+9V8FPPLSxXY7UpQNprKk30Vdze1YtYn we8tVRmZpf0SB8mQ84LLTidkx08w2fKPYY1s1PJ36tg0bDvzJfiANtlbdWxDLY28ZoxW dNIvDWC8Cd6Hpl5LZ2yKWw9NUkSpvsXnHTjbQ9nz0onBlMJ7I0MDBnTXSNgsa/0U47Gw PfJ3dxlKCsOQjb2OPj35SnVTcJHDubpTXevL+gbJnLTVtgFI+kLbsjgEgf9FbEOuDt41 C4MI2e2yn3XOQ1XwpxsjZb1CqYL6UNrbY+DJP6zl6rzdOZFewH+at5jXREYwRVjJ5gW+ 9Jig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7Gg36uRD0XHPP/bgzDkVeR+D5UCkWGxmhXx93AK3qDw=; fh=IEdUhjiPZAN8vQRYwPVkC6/3dbM5bmtlD6zqZ8Uk4Kk=; b=TQurD5WbtrsEIxCIGWiyouxWMP+wMFF5GO1+BtxF2sAsjqs6NUV396gVxRWfMsEQ90 /II/XKq5zpUCp13dKaekgBCSm6ACUqDw9XfEyjKCi1tzjX9JVPqR7vhuQXzmEHF5soJt zypJCmpaPJL6oqnX4TdYbXdSwK0xZoKAujKTrPM9w4Pg2sv/CP6tcilmLScDXMRYH8N/ kG4bwlPKEAxYjw5JoERxvF4qy50QWVGNYT3Q1c4sSnPyZJVg6KfwKMAL68sZ0bXDtbJ4 mWaAz9gHaNcO1cl5xxJCwasT+WglrJvFKbbSl6Z0NcgugExJJnv0kvSKJuo+pRcBvy3O +Hlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=uiZg8eGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l1-20020a170902d04100b001c737e1db94si4060967pll.110.2023.10.04.11.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:37:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=uiZg8eGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7C38081E5563; Wed, 4 Oct 2023 11:37:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244447AbjJDSgx (ORCPT + 99 others); Wed, 4 Oct 2023 14:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244459AbjJDSgZ (ORCPT ); Wed, 4 Oct 2023 14:36:25 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA7C6A6 for ; Wed, 4 Oct 2023 11:36:21 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-668ebbcc0b6so522616d6.0 for ; Wed, 04 Oct 2023 11:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1696444581; x=1697049381; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=7Gg36uRD0XHPP/bgzDkVeR+D5UCkWGxmhXx93AK3qDw=; b=uiZg8eGR2JYnRrNpTeiX1SxG5V3MxG6R0zBF5Fh9HHZWVdVvWiuydwW3b3+MWswiOh Fis8ranlgGYQ7c3scp6bCWI95MO4NbaQxCffBDTj4GiMwH6QJXMC82U72UDKSRyAI3d7 13RxE2oer/NFjsDJDp03zzqCFA/7Rcjijg9ARV3QbWB6K326T4nmlPku9nfTNq9tch1j zVuxwqBziBqmLbyFmhI/F3uuvdTZytDekw4ewQMfbtwsukrR7JCUV9eyByQM7gqYYEcq C25KhmJAkeaHSwqfsQHU01UsMr5RpN1K5+iMN+bavLSgi+YEpYNQ+UeZWVftYc6JqBn8 yhmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696444581; x=1697049381; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7Gg36uRD0XHPP/bgzDkVeR+D5UCkWGxmhXx93AK3qDw=; b=UcfWm61vtH2IWSSQeJFoy0ztTFb3ch7Ha+uNLROoG08toe7mNuT1bO/iHbbUkZxM3B WkvaWl/wdLvqPLTnjw3XowpXkV1bjrwHOTCBBjCxT5kZ3lo8+GBtPCTOuj9Rhv/JIuOP ZY0xqh+olEkb/iJg9/3Pvk+feWppqzoOalBJTpTFwZCg80LbxjXTcZ/c+fke3/Wj+W9F p/8HM/6sobE0U2AYvs6XhXYVfFYw4rNFURIsC6zs7dMqs46c9Z10zu2IKQUOpwTCBwOW 23eSaE80G5nMjh3SchkLflrdMyRqKXxeyNE2sJnxQ2QPj17UUxAe7Nz8x+gno2ayg+b8 S1Ew== X-Gm-Message-State: AOJu0YwgfvNhRoHFYWh+2DB0uQw32/J+7Z5GCGKWqQOO7jr963ow+noC bJFjFcr8jEctlSnyksmjWs4PbQ== X-Received: by 2002:a05:6214:14f2:b0:65b:2660:f58d with SMTP id k18-20020a05621414f200b0065b2660f58dmr2491151qvw.2.1696444581068; Wed, 04 Oct 2023 11:36:21 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:753d]) by smtp.gmail.com with ESMTPSA id w10-20020a0cb54a000000b006655cc8f872sm1531785qvd.99.2023.10.04.11.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:36:20 -0700 (PDT) Date: Wed, 4 Oct 2023 14:36:19 -0400 From: Johannes Weiner To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: Yosry Ahmed , Andrew Morton , Shakeel Butt , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: memcg: refactor page state unit helpers Message-ID: <20231004183619.GB39112@cmpxchg.org> References: <20230922175741.635002-1-yosryahmed@google.com> <20230922175741.635002-2-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:37:28 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 04, 2023 at 11:02:11AM +0200, Michal Koutn? wrote: > On Tue, Oct 03, 2023 at 12:47:25PM -0700, Yosry Ahmed wrote: > > Those constants are shared with code outside of memcg, namely enum > > node_stat_item and enum vm_event_item, and IIUC they are used > > differently outside of memcg. Did I miss something? > > The difference is not big, e.g. > mod_lruvec_state(lruvec, WORKINGSET_ACTIVATE_BASE + type, delta); > could be > __count_memcg_events( > container_of(lruvec, struct mem_cgroup_per_node, lruvec)->memcg, > WORKINGSET_ACTIVATE_BASE + type, delta > ); > > Yes, it would mean transferring WORKINGSET_* items from enum > node_stat_item to enum vm_event_item. > IOW, I don't know what is the effective difference between > mod_memcg_lruvec_state() and count_memcg_events(). > Is it per-memcg vs per-memcg-per-node resolution? Yes, it's because of node resolution which event counters generally don't have. Some of the refault events influence node-local reclaim decisions, see mm/vmscan.c::snapshot_refaults(). There are a few other event counters in the stat array that people thought would be useful to have split out in /sys/devices/system/node/nodeN/vmstat to understand numa behavior better. It's a bit messy. Some events would be useful to move to 'stats' for the numa awareness, such as the allocator stats and reclaim activity. Some events would be useful to move to 'stats' for the numa awareness, but don't have the zone resolution required by them, such as kswapd/kcompactd wakeups. Some events aren't numa specific, such as oom kills, drop_pagecache.