Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+9319a4268a640e26b72b@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm: do not update memcg stats for NR_{FILE/SHMEM}_PMDMAPPED
Date: Mon, 6 May 2024 21:18:16 +0200	[thread overview]
Message-ID: <d189730a-aab7-4a3b-bc0f-6abe17ea2c91@redhat.com> (raw)
In-Reply-To: <CAJD7tkaPvYWhrMSHmM0n0hitFaDdusq7gQ=7+DTUQLODGdo6RQ@mail.gmail.com>

On 06.05.24 20:52, Yosry Ahmed wrote:
> On Mon, May 6, 2024 at 11:35 AM David Hildenbrand <david@redhat.com> wrote:
>>
>> On 06.05.24 19:00, Yosry Ahmed wrote:
>>> Do not use __lruvec_stat_mod_folio() when updating NR_FILE_PMDMAPPED and
>>> NR_SHMEM_PMDMAPPED as these stats are not maintained per-memcg. Use
>>> __mod_node_page_state() instead, which updates the global per-node stats
>>> only.
>>
>> What's the effect of this? IIUC, it's been that way forever, no?
> 
> Yes, but it has been the case that all the NR_VM_EVENT_ITEMS stats
> were maintained per-memcg, although some of those fields are not
> exposed anywhere.
> 
> Shakeel recently added commit14e0f6c957e39 ("memcg: reduce memory for
> the lruvec and memcg stats"), which changed this such that we only
> maintain the stats we actually expose per-memcg (via a translation
> table).

Valuable information we should add to the patch description :)

> 
> He also added commit 514462bbe927b ("memcg: warn for unexpected events
> and stats"), which warns if we try to update a stat per-memcg that we
> do not maintain per-memcg (i.e. the warning firing here). The goal is
> to make sure the translation table has all the stats it needs to have.
> 
> Both of these commits were just merged today into mm-stable, hence the
> need for the fix now. It is the warning working as intended. No Fixes
> or CC stable are needed, but if necessary I would think:

WARN* should usually be "Fixes:"d, because WARN* expresses a condition 
that shouldn't be happening.

Documentation/process/coding-style.rst contains details.

> 
> Fixes: 514462bbe927b ("memcg: warn for unexpected events and stats")
> 
> , because without the warning, the stat update will just be ignored.
> So if anything the warning should have been added *after* this was
> fixed up.

Ideally, yes. But if it's in mm-stable, we usually can no longer 
reshuffle patches (commit IDs stable).

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-05-06 19:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 17:00 [PATCH] mm: do not update memcg stats for NR_{FILE/SHMEM}_PMDMAPPED Yosry Ahmed
2024-05-06 17:01 ` Yosry Ahmed
2024-05-06 18:35 ` David Hildenbrand
2024-05-06 18:52   ` Yosry Ahmed
2024-05-06 19:18     ` David Hildenbrand [this message]
2024-05-06 19:22       ` Yosry Ahmed
2024-05-06 19:25 ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d189730a-aab7-4a3b-bc0f-6abe17ea2c91@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=syzbot+9319a4268a640e26b72b@syzkaller.appspotmail.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).