Subject: [PATCH] mm: page_alloc: remove duplication of free_one_page()

Remove duplication of free_one_page().

Cc: Casper Li <[email protected]>
Signed-off-by: Kuan-Ying Lee <[email protected]>
---
mm/page_alloc.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2f646773a934..f46af8616cac 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1262,7 +1262,6 @@ static void free_one_page(struct zone *zone,
static void __free_pages_ok(struct page *page, unsigned int order,
fpi_t fpi_flags)
{
- unsigned long flags;
int migratetype;
unsigned long pfn = page_to_pfn(page);
struct zone *zone = page_zone(page);
@@ -1277,13 +1276,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
*/
migratetype = get_pfnblock_migratetype(page, pfn);

- spin_lock_irqsave(&zone->lock, flags);
- if (unlikely(has_isolate_pageblock(zone) ||
- is_migrate_isolate(migratetype))) {
- migratetype = get_pfnblock_migratetype(page, pfn);
- }
- __free_one_page(page, pfn, zone, order, migratetype, fpi_flags);
- spin_unlock_irqrestore(&zone->lock, flags);
+ free_one_page(zone, page, pfn, order, migratetype, fpi_flags);

__count_vm_events(PGFREE, 1 << order);
}
--
2.18.0



2023-12-20 09:43:09

by Baolin Wang

[permalink] [raw]
Subject: Re: [PATCH] mm: page_alloc: remove duplication of free_one_page()

Hi,

On 12/20/2023 3:47 PM, Kuan-Ying Lee wrote:
> Remove duplication of free_one_page().
>
> Cc: Casper Li <[email protected]>
> Signed-off-by: Kuan-Ying Lee <[email protected]>

Just FYI:
There is already a same patch submitted, see:
https://lore.kernel.org/all/[email protected]/T/#u

> ---
> mm/page_alloc.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 2f646773a934..f46af8616cac 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1262,7 +1262,6 @@ static void free_one_page(struct zone *zone,
> static void __free_pages_ok(struct page *page, unsigned int order,
> fpi_t fpi_flags)
> {
> - unsigned long flags;
> int migratetype;
> unsigned long pfn = page_to_pfn(page);
> struct zone *zone = page_zone(page);
> @@ -1277,13 +1276,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
> */
> migratetype = get_pfnblock_migratetype(page, pfn);
>
> - spin_lock_irqsave(&zone->lock, flags);
> - if (unlikely(has_isolate_pageblock(zone) ||
> - is_migrate_isolate(migratetype))) {
> - migratetype = get_pfnblock_migratetype(page, pfn);
> - }
> - __free_one_page(page, pfn, zone, order, migratetype, fpi_flags);
> - spin_unlock_irqrestore(&zone->lock, flags);
> + free_one_page(zone, page, pfn, order, migratetype, fpi_flags);
>
> __count_vm_events(PGFREE, 1 << order);
> }