From patchwork Fri Sep 22 17:57:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13396299 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 23B75CD4847 for ; Fri, 22 Sep 2023 17:57:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B9806B02FE; Fri, 22 Sep 2023 13:57:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 969BA6B02FF; Fri, 22 Sep 2023 13:57:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 858B56B0300; Fri, 22 Sep 2023 13:57:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 765B56B02FE for ; Fri, 22 Sep 2023 13:57:46 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4A915C01FD for ; Fri, 22 Sep 2023 17:57:46 +0000 (UTC) X-FDA: 81264991332.01.9A0396C Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf06.hostedemail.com (Postfix) with ESMTP id 96E52180007 for ; Fri, 22 Sep 2023 17:57:44 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="XhiOMn/Q"; spf=pass (imf06.hostedemail.com: domain of 3l9UNZQoKCKggWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3l9UNZQoKCKggWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@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=1695405464; 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=TWhlillKWVcEeVnrDyY8Q3IYayRPjR5OTdgTyF2A4S0=; b=uVfw3jPmUGkcM85DlhEx8r6lN78tEGepVUkmnzIzEyM661CAnqCF20bbLtl+M2gzVranCh GgCLcYdcYBjLUL2HLPbQ/c69KEsNkwdCFt7nOV7neeQu/gtxXxZH72YrzSh4kVF/wOnT1V vYLeM4mbY0twD2pYa147Ix3Wv+duGDA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="XhiOMn/Q"; spf=pass (imf06.hostedemail.com: domain of 3l9UNZQoKCKggWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3l9UNZQoKCKggWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695405464; a=rsa-sha256; cv=none; b=oIBFc6kv38GgDqO80IAwDIKKMfIGT+sw/geAL2mi0QOo8MKZb4nZXbIEPQNO3Lcr5Tljg/ he5tG73yd/lIJk39CEBWdF0cfCzih3lL6F7v5YAuNjZwf5pEpAFSdcPYyVT97NCmU61/1m HL1H7MCfnamgW1xK6zb3JOA4RihSkN0= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-59e8ebc0376so35163417b3.2 for ; Fri, 22 Sep 2023 10:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695405463; x=1696010263; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=TWhlillKWVcEeVnrDyY8Q3IYayRPjR5OTdgTyF2A4S0=; b=XhiOMn/QinW2cVKEnngk+jC6FgcwWVIldQyLEnOHtGw2ybWEQjV36uwyjB1Md/l/QT 2Ned7YDgKNZ0HW5xoutA2UsfxjRKnxKDDbqH5bWP2f+BA3tbltESFFWouC85KcRUA1sq S4/CtGeuKakDAhdJmsxbzo54To7N8lUec78aF6RLiMcq9zkc9EKYhTbc5/9vJyvR2LtZ oDKA7nOtMvGd/FqSMdI9JzlTkN/Q/LLwMjZMCESya9O83cgWE+SYLinXvwqixeT/2Jxh vxv0HaupRjDLtUCxlcaJFspjTcpYae8G+5IfFg9FiM7jBxG4GLHs6AD1a8OsW0+qruJS Vsww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695405463; x=1696010263; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TWhlillKWVcEeVnrDyY8Q3IYayRPjR5OTdgTyF2A4S0=; b=SG7RMoXr2XD7fskS+wfXiTEEMP8qZnroHllfKFKHHESe2eB6IWhaB3fZicW7Kwyu3p Q8n9ZmFh4OglfwYjX1i1TGW68acDHEvUW+oCsBp/zsn1gbNZ51OSV3rNAUomtp47D5RQ D49ojJfp9T25Im3Z+/K5mZBi+exvlbRQmXSnaQoi5ulehEf/sZ226pR2LZZglQ9Z+PEM cHk7y4RkYdxSq//SlP/E+DOLy4fK2pw1ze0BCGcOSF1zq/pV22reCAIKxIDCKo2e8jDC b4jcrXVu+8SMPwoiPp6nsdp6zsOoSaL5uPCD79BqtYuHiOeA+rerFTikCMSKit+iI4Vm W/Tw== X-Gm-Message-State: AOJu0Yw+uJDG2vXhP8i1Sj5fPUhLRKWnzIbC1xrLuITDQGcToAolt3CD bxCdExMxvq4xqXrGXuCyINNdKkncIYi7npk/ X-Google-Smtp-Source: AGHT+IHEaQf18bKeGdlnoKYY1mRA3LamvJr+H7xbuexfhbmBx44hNVCD9XA/gUtzgCmW8MrZ2JYiKVQxx+nJcwLq X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a0d:ec49:0:b0:59b:d857:8317 with SMTP id r9-20020a0dec49000000b0059bd8578317mr6978ywn.2.1695405463484; Fri, 22 Sep 2023 10:57:43 -0700 (PDT) Date: Fri, 22 Sep 2023 17:57:38 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Message-ID: <20230922175741.635002-1-yosryahmed@google.com> Subject: [PATCH v2 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: 96E52180007 X-Rspam-User: X-Stat-Signature: 6ay33jaog7hqu8jet1h1w191raf4gr59 X-Rspamd-Server: rspam01 X-HE-Tag: 1695405464-56410 X-HE-Meta: U2FsdGVkX1/UpZ5wCzSV1SUBn3AJvO0wc0Tn7d+21R0DjlEqeh5eCpoO3REgmq3YoCrgIOEmbL4QVEvjE+nzUaUQic3VbwDtjxnr8qGgxLcbRMrQxsAIT+4HbJTK41fVodiTNAzlXQRfnNqIasZTB6gWrYsAyTI/OZ6X2myYEB+GSB4dBUxUjS9qkZ5yWep510BTI5NwPXuuVxccnYV4sW9SYcddcZ/zaVtLqgB02u0wIbStig8iWKNN8YZNm5yRSbh3xuvJjUVScivhA2ZyrEo1F07kAxa9mU2kupHfkpPaa/GFR7TOTWH8HSS1RGXHtv/uZptS7CBScwW3JjRldsoBdwNm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SN3v28NYVcjFyMUKnnK7w6032ZJEfpd7HmPf2hs8uFIFfDF1OSrNkubtKQld98OH1AmXn3Ir9UJDBHIfD2L1p+oB4bgn+lXrhTLd23Kgkkl5qvrbaQZbwHGAvk+le9G97s7XELkRNct9HuoE4oRSOrGkQRTabDXgpnVGU8YuLc5vmTt85cCJEeo0DvFMHLejDJg1LF5mdqMOJNV3yhg3LP6VHxzgTBPgFjbF2Dg28DudwdCTz2rX924QQsYeAklvsSP2PncY/vPg X-Bogosity: Ham, tests=bogofilter, spamicity=0.015457, 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/ v1 -> v2: - Rebased on top of mm-unstable. 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(-)