Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2739693rdb; Wed, 4 Oct 2023 09:59:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHWHj7Wv2/pqARmG8bXjuAmbqsrAe7XmVHfWPi+5WAt2Gy2GyP4ySisSzmasC3jT5mkcyQ X-Received: by 2002:a17:90b:4b4b:b0:276:79b6:8bd6 with SMTP id mi11-20020a17090b4b4b00b0027679b68bd6mr2688169pjb.15.1696438783799; Wed, 04 Oct 2023 09:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696438783; cv=none; d=google.com; s=arc-20160816; b=WFa0cibLyZid8S0I5/fKMAFjBHBbrY9Hhc14oK/yKM8qEcGVZPX+uYi3z/IKxi9u9g 2EuEU45jE3qFnpJM3XVMpHd7NuthSXEki4W6m+pcYUxXMvKaIw9I6mInVfDt2tG0EJhv B/JQ0FaQe+IZ/WUHPw+UUM0+nh4IGcMbfSF1kzyk+W/tnJ40DH5105/RPFO+3iPzLhh0 eJ2RzW11QdP0XvV0Ha70Y9m8uxKP9ocFfe4oPmkV+O2a4c7EItEA+SMgHuoAPi/4Vb0y qtAv13JMxwhzXcvdHwlHXYDeDYbzuu37Ur+55aU+v/vAYjYV0C3g/puebZzYRJl1xB/8 NweQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eSLEpMzuN33kxQzm5qH/gkILKAwB7b5zDmsWnwSQOLs=; fh=fVAARXGpe2ArlgxbT2wxNweCW5mGhZW6NqVTKyogSLw=; b=HmQ6XNvaD0ExHxEcaVGJkmys1j72EOvm0mvSg/mSkRM9NBdasZj3WKZLyVnx59kaUd TjgbBW53SPNFrFyvImSnT6h8bgZlLcWUvwasZhy8ffKYg7MGxeGJd2o3fdPmfBxN5qzo OirG3iKGbh+Dcg6c1AQOLGF+ZgZ3+hXVIcF8ZTkKBCB6lRtjPO9s5nA5Wc6X+e1KmYt+ C5HuE7B82T9rd5ZI8Y4XPl7CdsNeYkMpZSPNqAJZNXTJHpQ77IV29y38PWvQYQi7gkX5 WtCd4Kxt3Is4po+xhF8LJPb7mLP9dNk0/HlG1KyLoG0M+4qAWbL8CzX6rw0LwYd6EpgU Y3aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OZ+j78O0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id c13-20020a17090a8d0d00b002773af24826si1826338pjo.123.2023.10.04.09.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 09:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OZ+j78O0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CE110837340F; Wed, 4 Oct 2023 09:59:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233437AbjJDQ7d (ORCPT + 99 others); Wed, 4 Oct 2023 12:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243307AbjJDQ7c (ORCPT ); Wed, 4 Oct 2023 12:59:32 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CC9AB for ; Wed, 4 Oct 2023 09:59:27 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9ada2e6e75fso8017966b.2 for ; Wed, 04 Oct 2023 09:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696438766; x=1697043566; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eSLEpMzuN33kxQzm5qH/gkILKAwB7b5zDmsWnwSQOLs=; b=OZ+j78O0gPwUe7JHH0M1B1PDBEFNvVGyrobC0TFxPlaErg6ZVq+Dd9K3OB7WXS/yL3 /kt1xDOwW8df5Jx9y0aipX7imL3vFIjm2OlW4MCDu4GGqO7cHZrTnq+fuJ41Pb2rFltZ CKJbYQ9jEeLM7Srngueh9jGpgcjemOT4blDH7B9qYCqlK5mYf4+/iSOzOQr5c3dQw9Zo I8ItfSfMbmjqyzithbolRukVEUGQUjLjFtl8gMfGPbNkNFjaV56Lfoi0gaUv/q1z6zTo Wo45e/ayxAZR/c5h5quSz5rsn78Mv2gzFwKsskr9vLDcwnrHKMaBreYH5tIKKhbbJgLY HxCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696438766; x=1697043566; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eSLEpMzuN33kxQzm5qH/gkILKAwB7b5zDmsWnwSQOLs=; b=gJ9Z1FMLBj1bjztUHMMKfy7kjfh4UP5jwzfsvN2ixlsnmun9VvwfitdvzO6jHlCZFQ Z1SHsc2fOqk6vHym8i0wrZvd8sfNoPTjK56xV8HRRJm+rsGIIj5rm4lwl3iT/XcQdkOB UG628RPQ1RwcMZ3acCgwCgrRgK20tvQ93rD5yFK/VfCVY7cRJFwRC/j9XHXq2IvWvZqd ASdyvZ5q4R1otObg6dbNt/vzZ9+d+dC3PtFWFoxSQ4oXMgiHfCmA/8anUmxQhpmuUvp0 lD+d+gf7fZDSNTXu0i4VrorzqNbtT8qc9kXYKNOsyqIHELnEBSFc1sN5r8m7peXJh/oL oo8g== X-Gm-Message-State: AOJu0YwlyJBNYIp6Uu/lmy0QlSpWNMKRjRm+1AYFEywGUsjmGcCIxhuR ZdjTK4TDxTVWyXtLuamr+9krMtJNqPMmHZSIRq/4xg== X-Received: by 2002:a17:906:7485:b0:9ae:5fe1:ef03 with SMTP id e5-20020a170906748500b009ae5fe1ef03mr2430403ejl.67.1696438765556; Wed, 04 Oct 2023 09:59:25 -0700 (PDT) MIME-Version: 1.0 References: <20230922175741.635002-1-yosryahmed@google.com> <20230922175741.635002-2-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Wed, 4 Oct 2023 09:58:46 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] mm: memcg: refactor page state unit helpers To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Andrew Morton , Shakeel Butt , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 09:59:37 -0700 (PDT) On Wed, Oct 4, 2023 at 2:02=E2=80=AFAM Michal Koutn=C3=BD 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? > (Is _that_ read by workingset mechanism?) Even if it is not read, I think it is exposed in memory.numa_stat, right? Outside of memcg code, if you look at vmstat_start(), you will see that the items in enum vm_event_item are handled differently (see all_vm_events()) when reading vmstat. I don't think we can just move it, unfortunately. > > Thanks, > Michal