From: David Hildenbrand <david@redhat.com>
To: Zi Yan <ziy@nvidia.com>, linux-mm@kvack.org
Cc: Matthew Wilcox <willy@infradead.org>,
Vlastimil Babka <vbabka@suse.cz>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Michal Hocko <mhocko@kernel.org>,
John Hubbard <jhubbard@nvidia.com>,
linux-kernel@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [RFC PATCH 09/15] virtio: virtio_mem: use PAGES_PER_SECTION instead of MAX_ORDER_NR_PAGES
Date: Mon, 9 Aug 2021 09:35:12 +0200 [thread overview]
Message-ID: <3e2f1910-e7d9-ddf9-063b-d702793f1525@redhat.com> (raw)
In-Reply-To: <20210805190253.2795604-10-zi.yan@sent.com>
On 05.08.21 21:02, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> It keeps the existing behavior when MAX_ORDER grows beyond a section
> size.
>
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/virtio/virtio_mem.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 19036922f7ef..bab5a81fa796 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -1105,11 +1105,11 @@ static void virtio_mem_clear_fake_offline(unsigned long pfn,
> */
> static void virtio_mem_fake_online(unsigned long pfn, unsigned long nr_pages)
> {
> - const unsigned long max_nr_pages = MAX_ORDER_NR_PAGES;
> + const unsigned long max_nr_pages = PAGES_PER_SECTION;
> unsigned long i;
>
> /*
> - * We are always called at least with MAX_ORDER_NR_PAGES
> + * We are always called at least with PAGES_PER_SECTION
> * granularity/alignment (e.g., the way subblocks work). All pages
> * inside such a block are alike.
> */
> @@ -1125,7 +1125,7 @@ static void virtio_mem_fake_online(unsigned long pfn, unsigned long nr_pages)
> if (PageDirty(page)) {
> virtio_mem_clear_fake_offline(pfn + i, max_nr_pages,
> false);
> - generic_online_page(page, MAX_ORDER - 1);
> + generic_online_page(page, PAGES_PER_SECTION - 1);
> } else {
> virtio_mem_clear_fake_offline(pfn + i, max_nr_pages,
> true);
> @@ -1228,7 +1228,7 @@ static void virtio_mem_online_page_cb(struct page *page, unsigned int order)
> if (vm->in_sbm) {
> /*
> * We exploit here that subblocks have at least
> - * MAX_ORDER_NR_PAGES size/alignment - so we cannot
> + * PAGES_PER_SECTION size/alignment - so we cannot
> * cross subblocks within one call.
> */
> id = virtio_mem_phys_to_mb_id(addr);
> @@ -2438,14 +2438,14 @@ static int virtio_mem_init(struct virtio_mem *vm)
> VIRTIO_MEM_DEFAULT_OFFLINE_THRESHOLD);
>
> /*
> - * We want subblocks to span at least MAX_ORDER_NR_PAGES and
> + * We want subblocks to span at least PAGES_PER_SECTION and
> * pageblock_nr_pages pages. This:
> * - Simplifies our page onlining code (virtio_mem_online_page_cb)
> * and fake page onlining code (virtio_mem_fake_online).
> * - Is required for now for alloc_contig_range() to work reliably -
> * it doesn't properly handle smaller granularity on ZONE_NORMAL.
> */
> - sb_size = max_t(uint64_t, MAX_ORDER_NR_PAGES,
> + sb_size = max_t(uint64_t, PAGES_PER_SECTION,
> pageblock_nr_pages) * PAGE_SIZE;
> sb_size = max_t(uint64_t, vm->device_block_size, sb_size);
>
>
This is very much completely broken and destroys most of the purpose of
virtio-mem. It even is broken once MAX_ORDER would exceed a single
memory section I think.
Whatever you do, keep virtio-mem working *as is* unless someone
explicitly sets MAX_ORDER on the command line to something bigger.
virtio-mem will require some minor adjustments once MAX_ORDER_NR_PAGES
would exceed the memory section size -- the functionality will, however,
be heavily degraded once you increase MAX_ORDER_NR_PAGES in any way
(again, which is fine if it's explicitly done by an admin on the command
line).
As mentioned somewhere else already, we'll have to tackle
alloc_contig_range() to properly deal with pageblock_order granularity,
then we can rework virtio-mem code to be based on that instead of
MAX_ORDER - 1.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-08-09 7:35 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-05 19:02 [RFC PATCH 00/15] Make MAX_ORDER adjustable as a kernel boot time parameter Zi Yan
2021-08-05 19:02 ` [RFC PATCH 01/15] arch: x86: remove MAX_ORDER exceeding SECTION_SIZE check for 32bit vdso Zi Yan
2021-08-05 19:02 ` [RFC PATCH 02/15] arch: mm: rename FORCE_MAX_ZONEORDER to ARCH_FORCE_MAX_ORDER Zi Yan
2021-08-05 19:02 ` [RFC PATCH 03/15] mm: check pfn validity when buddy allocator can merge pages across mem sections Zi Yan
2021-08-05 19:02 ` [RFC PATCH 04/15] mm: prevent pageblock size being larger than section size Zi Yan
2021-08-05 19:02 ` [RFC PATCH 05/15] mm/memory_hotplug: online pages at " Zi Yan
2021-08-05 19:02 ` [RFC PATCH 06/15] mm: use PAGES_PER_SECTION instead for mem_map_offset/next() Zi Yan
2021-08-05 19:02 ` [RFC PATCH 07/15] mm: hugetlb: use PAGES_PER_SECTION to check mem_map discontiguity Zi Yan
2021-08-05 19:02 ` [RFC PATCH 08/15] fs: proc: use PAGES_PER_SECTION for page offline checking period Zi Yan
2021-08-07 10:32 ` Mike Rapoport
2021-08-09 15:45 ` [RFC PATCH 08/15] " Zi Yan
2021-08-05 19:02 ` [RFC PATCH 09/15] virtio: virtio_mem: use PAGES_PER_SECTION instead of MAX_ORDER_NR_PAGES Zi Yan
2021-08-09 7:35 ` David Hildenbrand [this message]
2021-08-05 19:02 ` [RFC PATCH 10/15] virtio: virtio_balloon: " Zi Yan
2021-08-09 7:42 ` David Hildenbrand
2021-08-05 19:02 ` [RFC PATCH 11/15] mm/page_reporting: report pages at section size instead of MAX_ORDER Zi Yan
2021-08-09 7:25 ` David Hildenbrand
2021-08-09 14:12 ` Alexander Duyck
2021-08-09 15:08 ` Zi Yan
2021-08-09 16:51 ` Alexander Duyck
2021-08-09 14:08 ` Alexander Duyck
2021-08-05 19:02 ` [RFC PATCH 12/15] mm: Make MAX_ORDER of buddy allocator configurable via Kconfig SET_MAX_ORDER Zi Yan
2021-08-06 15:16 ` Vlastimil Babka
2021-08-06 15:23 ` Zi Yan
2021-08-05 19:02 ` [RFC PATCH 13/15] mm: convert MAX_ORDER sized static arrays to dynamic ones Zi Yan
2021-08-05 19:16 ` Christian König
2021-08-05 19:58 ` Zi Yan
2021-08-06 9:37 ` Christian König
2021-08-06 14:00 ` Zi Yan
2021-08-05 19:02 ` [RFC PATCH 14/15] mm: introduce MIN_MAX_ORDER to replace MAX_ORDER as compile time constant Zi Yan
2021-08-08 8:23 ` Mike Rapoport
2021-08-09 15:35 ` Zi Yan
2021-08-05 19:02 ` [RFC PATCH 15/15] mm: make MAX_ORDER a kernel boot time parameter Zi Yan
2021-08-06 15:36 ` [RFC PATCH 00/15] Make MAX_ORDER adjustable as " Vlastimil Babka
2021-08-06 16:16 ` David Hildenbrand
2021-08-06 16:54 ` Vlastimil Babka
2021-08-06 17:08 ` David Hildenbrand
2021-08-06 18:24 ` Zi Yan
2021-08-09 7:20 ` David Hildenbrand
2021-08-08 7:41 ` Mike Rapoport
2021-08-06 16:32 ` Vlastimil Babka
2021-08-06 17:19 ` Zi Yan
2021-08-06 20:27 ` Hugh Dickins
2021-08-06 21:26 ` Zi Yan
2021-08-09 4:04 ` Hugh Dickins
2021-08-07 1:10 ` Matthew Wilcox
2021-08-07 21:23 ` Matthew Wilcox
2021-08-09 4:29 ` Hugh Dickins
2021-08-09 11:22 ` Matthew Wilcox
2021-08-09 7:41 ` 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=3e2f1910-e7d9-ddf9-063b-d702793f1525@redhat.com \
--to=david@redhat.com \
--cc=jasowang@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=mst@redhat.com \
--cc=vbabka@suse.cz \
--cc=virtualization@lists.linux-foundation.org \
--cc=willy@infradead.org \
--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).