linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: David Hildenbrand <david@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Brendan Jackman" <jackmanb@google.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>, "Zi Yan" <ziy@nvidia.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: Re: [PATCH v2 1/1] mm/memory_hotplug: PG_offline_skippable for offlining memory blocks with PageOffline pages
Date: Fri, 23 May 2025 11:18:36 +0200	[thread overview]
Message-ID: <aDA9bCYzE2qENfDv@localhost.localdomain> (raw)
In-Reply-To: <d7b756cc-8a39-4124-ab57-912bb97ed967@redhat.com>

On Wed, May 21, 2025 at 03:44:32PM +0200, David Hildenbrand wrote:
> No, the code is confusing.
> 
> All pages are PageOffline. Only the ones that have not been onlined are *in
> addition* PageDirty.
> 
> The relevant bit is documented in page-flags.h:
> 
> "When a memory block gets onlined, all pages are initialized with a refcount
> of 1 and PageOffline(). generic_online_page() will take care of clearing
> PageOffline()."

Ah ok, I see it in __free_pages_core().


> > - If we want to release logically-offline pages belonging to an onlined memory-block,
> >    we ClearDirty them and be done
> 
> PageOffline gets cleared in both cases: See the comment in
> virtio_mem_clear_fake_offline()
> 
> "/* generic_online_page() will clear PageOffline(). */"
> 
> I'll note that I am planning on removing that PageDirty() handling
> completely, and also letting handling PageOffline() clearing be always
> performed by memory freeing core (the latter is easier to achieve).

Cool, I think that would be much clearer.

 
> When re-onlining, the core will set them all PageOffline, and virtio-mem
> will intercept page onlining using the page_online_cb.
> 
> virtio-mem will then online the actually plugged parts (->
> generic_online_page(), which clears PageOffline and exposes them to the
> buddy) and set the unplugged/hole parts as PageOfflineSkipabble again.
> 
> That logic resides in virtio_mem_online_page_cb().

Sorry, I had to re-cache this.
Ok, I think that now I caught up with the code.

I see that we mark it Offline in memmap_init_range(), and then
__free_pages_core() will clear the flag before releasing them to the
buddy.

Ok, I think it is much clear now, thanks for helping me out with the
details! 

-- 
Oscar Salvador
SUSE Labs


  reply	other threads:[~2025-05-23  9:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 16:42 [PATCH v2 0/1] mm/memory_hotplug: introduce and use PG_offline_skippable David Hildenbrand
2025-05-20 16:42 ` [PATCH v2 1/1] mm/memory_hotplug: PG_offline_skippable for offlining memory blocks with PageOffline pages David Hildenbrand
2025-05-21 13:32   ` Oscar Salvador
2025-05-21 13:44     ` David Hildenbrand
2025-05-23  9:18       ` Oscar Salvador [this message]
2025-05-23  9:20   ` Oscar Salvador
2025-05-30 16:54   ` Vlastimil Babka
2025-06-02 20:55     ` David Hildenbrand

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=aDA9bCYzE2qENfDv@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mst@redhat.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=virtualization@lists.linux.dev \
    --cc=willy@infradead.org \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=ziy@nvidia.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 NNTP newsgroup(s).