From: David Hildenbrand <david@redhat.com>
To: Kent Overstreet <kent.overstreet@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, linux-raid@vger.kernel.org,
linux-block@vger.kernel.org, axboe@kernel.dk
Cc: alexander.h.duyck@linux.intel.com
Subject: Re: [PATCH 1/5] mm: Make free_area->nr_free per migratetype
Date: Wed, 13 Oct 2021 18:33:06 +0200 [thread overview]
Message-ID: <e29733c7-e65a-935a-4e05-3a060240ea5a@redhat.com> (raw)
In-Reply-To: <20211013160034.3472923-2-kent.overstreet@gmail.com>
Mostly LGTM. I recall that in some corner cases the migratetype stored
for a pcppage does not correspond to the pagetype of the pfnblock ... I
do wonder if that can trick us here in doing some accounting wrong., no
that we account free pages per mirgatetype.
> /*
> * Set the pageblock if the isolated page is at least half of a
> @@ -6038,14 +6038,16 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
> struct free_area *area = &zone->free_area[order];
> int type;
>
> - nr[order] = area->nr_free;
> - total += nr[order] << order;
> + nr[order] = 0;
> + types[order] = 0;
Why the indentation change? Looks unrelated to me.
>
> - types[order] = 0;
> for (type = 0; type < MIGRATE_TYPES; type++) {
> if (!free_area_empty(area, type))
> types[order] |= 1 << type;
> + nr[order] += area->nr_free[type];
> }
> +
> + total += nr[order] << order;
> }
> spin_unlock_irqrestore(&zone->lock, flags);
> for (order = 0; order < MAX_ORDER; order++) {
> @@ -6623,7 +6625,7 @@ static void __meminit zone_init_free_lists(struct zone *zone)
> unsigned int order, t;
> for_each_migratetype_order(order, t) {
> INIT_LIST_HEAD(&zone->free_area[order].free_list[t]);
> - zone->free_area[order].nr_free = 0;
> + zone->free_area[order].nr_free[t] = 0;
> }
> }
>
> @@ -9317,6 +9319,7 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
> struct page *page;
> struct zone *zone;
> unsigned int order;
> + unsigned int migratetype;
> unsigned long flags;
>
> offline_mem_sections(pfn, end_pfn);
> @@ -9346,7 +9349,8 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
> BUG_ON(page_count(page));
> BUG_ON(!PageBuddy(page));
> order = buddy_order(page);
> - del_page_from_free_list(page, zone, order);
> + migratetype = get_pfnblock_migratetype(page, pfn);
As the free pages are isolated, theoretically this should be
MIGRATE_ISOLATE.
> + del_page_from_free_list(page, zone, order, migratetype);
> pfn += (1 << order);
> }
> spin_unlock_irqrestore(&zone->lock, flags);
> @@ -9428,7 +9432,7 @@ bool take_page_off_buddy(struct page *page)
> int migratetype = get_pfnblock_migratetype(page_head,
> pfn_head);
>
> - del_page_from_free_list(page_head, zone, page_order);
> + del_page_from_free_list(page_head, zone, page_order, migratetype);
> break_down_buddy_pages(zone, page_head, page, 0,
> page_order, migratetype);
> if (!is_migrate_isolate(migratetype))
> diff --git a/mm/page_reporting.c b/mm/page_reporting.c
> index 382958eef8..4e45ae95db 100644
> --- a/mm/page_reporting.c
> +++ b/mm/page_reporting.c
> @@ -145,7 +145,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,
> * The division here should be cheap since PAGE_REPORTING_CAPACITY
> * should always be a power of 2.
> */
> - budget = DIV_ROUND_UP(area->nr_free, PAGE_REPORTING_CAPACITY * 16);
> + budget = DIV_ROUND_UP(area->nr_free[mt], PAGE_REPORTING_CAPACITY * 16);
>
I think we might want the total free pages here. If we want to change
the behavior, we should do it in a separate patch.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-10-13 16:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 16:00 [PATCH 0/5] Minor mm/struct page work Kent Overstreet
2021-10-13 16:00 ` [PATCH 1/5] mm: Make free_area->nr_free per migratetype Kent Overstreet
2021-10-13 16:33 ` David Hildenbrand [this message]
2021-10-14 14:45 ` Kent Overstreet
2021-10-18 7:44 ` Vlastimil Babka
2021-10-13 16:00 ` [PATCH 2/5] mm: Introduce struct page_free_list Kent Overstreet
2021-10-13 16:00 ` [PATCH 3/5] mm/page_reporting: Improve control flow Kent Overstreet
2021-10-13 16:00 ` [PATCH 4/5] md: Kill usage of page->index Kent Overstreet
2021-10-14 8:02 ` Guoqing Jiang
2021-10-14 8:58 ` heming.zhao
2021-10-14 14:30 ` [PATCH v2] " Kent Overstreet
2021-10-15 3:01 ` Guoqing Jiang
2021-10-15 8:59 ` heming.zhao
2021-10-13 16:00 ` [PATCH 5/5] brd: " Kent Overstreet
2021-10-14 14:27 ` Matthew Wilcox
2021-10-14 15:09 ` 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=e29733c7-e65a-935a-4e05-3a060240ea5a@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=axboe@kernel.dk \
--cc=kent.overstreet@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-raid@vger.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;
as well as URLs for NNTP newsgroup(s).