mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Wade <danjwade95@gmail.com>
To: David Hildenbrand <david@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R . Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	stable@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memory: mark unshare copies dirty to fix MADV_FREE data loss
Date: Tue, 17 Nov 2026 20:36:02 +1030	[thread overview]
Message-ID: <20261117100602.797-1-danjwade95@gmail.com> (raw)
In-Reply-To: <c7c8ba0f-49ff-4b22-bd24-20fc394b1e36@kernel.org>

On Tue, 17 Nov 2026 09:55:24 +0100
"David Hildenbrand (Arm)" <david@kernel.org> wrote:

> We should always prefer setting the pte dirty, not the folio, as the latter
> needs atomics.

Will do a v2 with your version, thanks.

> numa_maps does not show any such data. Did you mean smaps_rollup ?

It does, gather_stats() ors the pte bit with folio_test_dirty(). So I
kept it.

> A more future proof solution would be to only allow MADV_FREE if we are the
> exclusive folio owner, checked under folio lock.

Makes sense to me, it kills the whole class instead of one producer at a
time.

One thing though, that takes the folio lock on every folio. Right now a
clean exclusive one doesn't take it at all. If the lock is busy you skip
the folio, so jemalloc freeing a big range would leave some of it
behind.

      reply	other threads:[~2026-11-17 10:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 11:12 Daniel Wade
2026-11-17  8:55 ` David Hildenbrand (Arm)
2026-11-17 10:06   ` Daniel Wade [this message]

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=20261117100602.797-1-danjwade95@gmail.com \
    --to=danjwade95@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /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

all inboxes | Powered by JetHome®