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: 13395344 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 36E5DCD4F30 for ; Fri, 22 Sep 2023 08:25:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B755B6B0297; Fri, 22 Sep 2023 04:25:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B26006B0298; Fri, 22 Sep 2023 04:25:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ECE46B029A; Fri, 22 Sep 2023 04:25:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8B5856B0297 for ; Fri, 22 Sep 2023 04:25:48 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4F6FD120F86 for ; Fri, 22 Sep 2023 08:25:48 +0000 (UTC) X-FDA: 81263549976.25.6890A86 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf07.hostedemail.com (Postfix) with ESMTP id A8A3A40021 for ; Fri, 22 Sep 2023 08:25:46 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=egGKFgcQ; spf=pass (imf07.hostedemail.com: domain of 3iU8NZQoKCIwE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3iU8NZQoKCIwE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695371146; 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:in-reply-to: references:dkim-signature; bh=6DHfRiy16OkhCPchGcMG2Wr8n1hI6+/4vWiAKStiZAI=; b=lr9+ehQr3qYGtAfAHoF26L40UUuUmmKAMuJBmhlhyNzoUpYHWJob6nf3ss7k9ReD9ZnE64 KCBl28srbuOw+g1VvvAxQHfwdKXug4q7ZgWnRi11mlejEw96iDL7ir6P8WblL9QWAH+C4c sjNPSS7Kmq8dHM0A9NaSW7kH0ghIUcU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695371146; a=rsa-sha256; cv=none; b=HSQY1hp7kmGvXHnfUITnlxMk74WbruUdxhVP8HbHjyMJFewQpHqF1MobeT9oAezGC2JuoT hhjBy+MblyYWEXttKqBUQnXFs7Rgb8BzAxAt7QJP+HdhmTAxm1loDxOhggBa8lcbH84dKG hMEDxR9IsH7cg/X+JIhOWM2d4T8EBws= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=egGKFgcQ; spf=pass (imf07.hostedemail.com: domain of 3iU8NZQoKCIwE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3iU8NZQoKCIwE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-59b59e1ac70so28012117b3.1 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=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6DHfRiy16OkhCPchGcMG2Wr8n1hI6+/4vWiAKStiZAI=; b=egGKFgcQjUeEtckBoQfZTX0qNNASHdxS99QaCNNCg8MrbdCrU/gCuAqFTLk6WKeKIZ 9OjnsU0yQ7gwDIPTZsdZIMZgqxXKmopNWQGxA6PQNKMVzOLTsdvvaVnezZMdVAxeUBIC jrGsvi+9hsnV40yGfPh7lRitleex/x0LQj2lmEl06kkXy9UpzxAqtCANtlZCp+McemH9 IA5/gCHOX1Ui804Mt0bgk9hEE7x+LlQ5satpG16tebSpH+/ckSDDs7layvQ5hS6Xy1pN wT72v7UMf54LWmYzCXTRJ+3cWuKUnQcCeaZ4y5IGvUxUllX4njwk8fDUtWW5onE0zkxN 8ioQ== 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=SuJWkoU1tbd2E9LwJhoAALpAa5jHKTdyYvINGq5r4lstNxJ155Pl3NlUKZpX0tw0OY dpW8mbescqbnhHzbdzNmwaOGyKFj9CyKkfcUgo5aXBpJo6aKt1bbw6ZzPiPiXxrUTDdZ 5q0YfqP70/GQ4LJAxM2pDDUo2asnGFhp0xPMWY8ghFPBR046lXShgA/gsunsWOJL+D65 kfOkpaM9vwMHKr0/AyKRQ54ouAcfMLuakF1cWS11xCoaz08t61N5SCAS4bR6dhuU65nd Qp3Xbbiu+suHUIhKd/Do4k7no0G2kyBbb6dji0KnShPxRGl2gBHos+oGPFNM/Z9rdvyI cP6w== X-Gm-Message-State: AOJu0YxdZYX/YPTMonsvRvrsnCW5yMfSYfy97oi8GDzRTY8DWOIR2LNh GdmoADviTL7MlzI5gZnEfHJetpf1Hmg3CwMn X-Google-Smtp-Source: AGHT+IE3FBqDUOqRr+DcHoUUQ9BpPeYFPo2AfexflfmNzR4QbtyXevRCS9yUS0doAcOFrE4Z0r+YFn0lXrwSsS7T 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-Rspamd-Queue-Id: A8A3A40021 X-Rspam-User: X-Stat-Signature: snhrf9mu9fk14ca9qupsf84zx7sy9smj X-Rspamd-Server: rspam03 X-HE-Tag: 1695371146-407073 X-HE-Meta: U2FsdGVkX181o/VmpHT1vgqO9wnBgYm+gugrqLSXiGaQaoAcKAcCoRf5QuwO1A3asHsE5ZZUwoNzDwrnY964eJTXOSAUJlAzcITKkkqWk2TozwmdwtpRuDSvILp9w7dYNUDTefF8jSiBkpKxW2HqC2ETlA312s+SJTW2lvH6FLSp5FUMZMgoRVwmH0lA9RxmJXJc+fHVgwePSYlnTz8gX32rXMEl2IJFYmoQCN67uxP/EBJhgrNAJcBe9R/Lj0xguBTt94GjJdDEDMRjLiS3B/l9EmMghuVMkMKEue+0niiFXhCrxhOGJG3rx3s9TezDh6UZ7oLD+m0SQskG4d/xOXUDufwAsY8oeWHpy5++/LQKbk4PG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pt+lh8VnJ5suoDWDEQWLDZqLHPsYN5AGTRuyR0gNXy7zs9nA5mTKnNImXl6BZE8vSzdQMY6iXKxSZZJvGIlpw3D6Gu5bxv3KVgabPl2RT3uyuHqQXICRRHGytECm9229qwQUcM21SQiZ0jywMfSU9+3nca9kcaRHO+KAvT3Z9E9A75ztdaDfaUrZjmBdRsGtoGGisexkAh2KQs9yetDHv1NzebIFzxfWsTxkYWn70c4iWuIobqaVtRFSmZGa1Raos X-Bogosity: Ham, tests=bogofilter, spamicity=0.000784, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(-)