From patchwork Fri Sep 22 08:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 14387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5722254vqi; Fri, 22 Sep 2023 09:44:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYcduLNl9aIf6yM7/FNAdg+iThAmo1iSS98CsBxd4p/JsdHDNqyKlJ6iqXCnygnwqcold4 X-Received: by 2002:a17:907:2c4f:b0:99c:56d1:7c71 with SMTP id hf15-20020a1709072c4f00b0099c56d17c71mr8300440ejc.26.1695401046824; Fri, 22 Sep 2023 09:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695401046; cv=none; d=google.com; s=arc-20160816; b=P7RsOcWOqHqkWVSCcuqgqKZmQB6IlqYVqsZD2h7uyBvMvThDwa3LDwElVQO6+KcUba ouaKNwxTG53MSsiUdQZ+bkxyXtkrFN6WnF1hW+qvbFkWtuSEIuxa7DHGPNy30lhcamwj m9bQhZNJULHOv+MSXipjRCwvmKkWxuvqSQybOIe9mAkVg9AdUmI6MwJ6jHdxmozMw4yI JdMbWcZ2zfCW9qFw4ON2rpbg7tRI9I09XrqiYPKluEYS9N01jz6rkyWTxyMNwMRaqQII HahMqLKW9IseKEFgLbahaUPnqeO+25fjvM/cc0lidgnOfZTEI0Xrj2cdx9Vvk0JS79k3 aNug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=6DHfRiy16OkhCPchGcMG2Wr8n1hI6+/4vWiAKStiZAI=; fh=8R3NybVVYxF3mxyewwJ7cqkhC8pADgA9jxe98eswTvE=; b=zGZV1w2jWutuNE4gJX2/yg+pn+zELAO7QOYiLeoTb0Py9F/mZrbOs+rYHSi9qQXi0B ugWmXXl4gUSC5dXAVW0xRdkCJ8ZK4nAoo/ctjaFOF1wFHK5BaU5q2RNyp1eid48MNG8l PApe+g+LoQtM97eB5iJzUJOpXY6RApLhCzyB3QC3mutcjrry5ls/rd+XOpwS7WQslVWw LkMqboYrCjmFcdAcQJrHNNFKxHXo38I1h1biNjMv61usfNjOOstXlYdRg0g9sNd6dWLo eNAkea45Hd1SmltfXvoIsVVcXDJzMwYfhALiVdzUUD63VyDVtEHKgxpt1JI5U4ENazqp U+oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PO4IDZ1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id m12-20020a170906160c00b009ad84beca10si3629918ejd.765.2023.09.22.09.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 09:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PO4IDZ1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 0BC2E80725D5; Fri, 22 Sep 2023 01:26:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjIVIZx (ORCPT + 30 others); Fri, 22 Sep 2023 04:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjIVIZw (ORCPT ); Fri, 22 Sep 2023 04:25:52 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C60199 for ; Fri, 22 Sep 2023 01:25:46 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d81a76a11eeso2356267276.3 for ; Fri, 22 Sep 2023 01:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695371145; x=1695975945; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6DHfRiy16OkhCPchGcMG2Wr8n1hI6+/4vWiAKStiZAI=; b=PO4IDZ1CB4avwfl3+ABGZsQgyS0OgbqDTbDSsd/oo5A1NOkxQyfLG/b+73VZ8Q2Jmc ogmIkaIDH4lSZuvsRh9BHQiMjpFuLjnl6mvazisQhMeZprACGdFk9EBsXfgbDKXOIhOp UUqr/8pj4b8na8fxqnevO6zqQiFohqr+Cde1vQh5X/xTfiVVfohXV6Eo7pDCLQ1RzYJ2 nqxm1ccoeJlcpcucz//1Zl8rUuZiZWtrlCpy0HeCDj61qvqMknFC4JVsy1EjiaSwlH+3 BjeJfyodIQiwAosBX6lrTU2GZiVnN5fKqxHX4FUT4zqhQ39RuzJ0LmMySUNiZzfFkC+Y /FQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695371145; x=1695975945; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6DHfRiy16OkhCPchGcMG2Wr8n1hI6+/4vWiAKStiZAI=; b=P89c5aZXbAl5Vkmx9Q9BFU1INYWNpsZ/8OOGI44MizsMdDAtF20CXKeM3DhXNAVieK GfuA31+g1Y7yvKZI7R2bEUDWivh4xn3GKG9uPKFtswcqr0tGCqY2YKOLyEA8a6vaIi8K uZNucTY/K3mqzHBbibhg3kEfIvBVOLYbtEsLp796pLmp4PgN+GBawLquj3ei/jBgiLPx hZOnxgg+jgRM3Key1jhr3iWHU4t0fLvHLrD9d/muMRZw2w7/8rtbn/DswpXj9UZKJMKC g/Pz6ZXzq9bybjqkSIDI9N3ek5ABBN0EHOdAcDrZR70fV5hL2mJ/yaBa0t8Fenmys6iq OwYQ== X-Gm-Message-State: AOJu0Yzz+2PjjV7moto03M4gQvUtg5UaoEBn/hUhoJREoxWZ7PY0F1hL 2KLTNvJ0GkbBogJvUHRZ3KUaf4StNlSWmw03 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a25:ac55:0:b0:d80:cf4:7e80 with SMTP id r21-20020a25ac55000000b00d800cf47e80mr97585ybd.7.1695371145763; Fri, 22 Sep 2023 01:25:45 -0700 (PDT) Date: Fri, 22 Sep 2023 08:25:40 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Message-ID: <20230922082542.466579-1-yosryahmed@google.com> Subject: [PATCH 0/2] mm: memcg: fix tracking of pending stats updates values From: Yosry Ahmed To: Andrew Morton , Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , " =?utf-8?q?Michal_Koutn=C3=BD?= " , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 22 Sep 2023 01:26:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777756848199939039 X-GMAIL-MSGID: 1777756848199939039 While working on adjacent code [1], I realized that the values passed into memcg_rstat_updated() to keep track of the magnitude of pending updates is consistent. It is mostly in pages, but sometimes it can be in bytes or KBs. Fix that. Patch 1 reworks memcg_page_state_unit() so that we can reuse it in patch 2 to check and normalize the units of state updates. [1]https://lore.kernel.org/lkml/20230921081057.3440885-1-yosryahmed@google.com/ Yosry Ahmed (2): mm: memcg: refactor page state unit helpers mm: memcg: normalize the value passed into memcg_rstat_updated() mm/memcontrol.c | 64 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 13 deletions(-)