lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a43c866f-b281-49d3-b503-f5f86dadd306@redhat.com>
Date: Mon, 2 Sep 2024 11:06:40 +0200
From: David Hildenbrand <david@...hat.com>
To: Zi Yan <ziy@...dia.com>, linux-mm@...ck.org
Cc: Oscar Salvador <osalvador@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
 Johannes Weiner <hannes@...xchg.org>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>,
 "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
 Mel Gorman <mgorman@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 4/4] mm/page_isolation: remove migratetype parameter
 from more functions.

On 28.08.24 22:22, Zi Yan wrote:
> migratetype is no longer overwritten during pageblock isolation,
> start_isolate_page_range(), has_unmovable_pages(), and
> set_migratetype_isolate() no longer need which migratetype to restore
> during isolation failure. For has_unmoable_pages(), it needs to know if
> the isolation is for CMA allocation, so adding CMA_ALLOCATION to isolation
> flags to provide the information.
> 
> Signed-off-by: Zi Yan <ziy@...dia.com>
> ---
>   include/linux/page-isolation.h |  3 ++-
>   mm/memory_hotplug.c            |  1 -
>   mm/page_alloc.c                |  4 +++-
>   mm/page_isolation.c            | 27 +++++++++++----------------
>   4 files changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index c2a1bd621561..e94117101b6c 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -32,13 +32,14 @@ static inline bool is_migrate_isolate(int migratetype)
>   
>   #define MEMORY_OFFLINE	0x1
>   #define REPORT_FAILURE	0x2
> +#define CMA_ALLOCATION	0x4
>   
>   void set_pageblock_migratetype(struct page *page, int migratetype);
>   
>   bool move_freepages_block_isolate(struct zone *zone, struct page *page);
>   
>   int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
> -			     int migratetype, int flags, gfp_t gfp_flags);
> +			     int flags, gfp_t gfp_flags);
>   
>   void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn);
>   
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 4265272faf4c..fe0b71e0f307 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1993,7 +1993,6 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
>   
>   	/* set above range as isolated */
>   	ret = start_isolate_page_range(start_pfn, end_pfn,
> -				       MIGRATE_MOVABLE,
>   				       MEMORY_OFFLINE | REPORT_FAILURE,
>   				       GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL);
>   	if (ret) {
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 4d06932ba69a..c60bb95d7e65 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6607,7 +6607,9 @@ int alloc_contig_range_noprof(unsigned long start, unsigned long end,
>   	 * put back to page allocator so that buddy can use them.
>   	 */
>   
> -	ret = start_isolate_page_range(start, end, migratetype, 0, gfp_mask);
> +	ret = start_isolate_page_range(start, end,
> +			migratetype == MIGRATE_CMA ? CMA_ALLOCATION : 0,

Can we have flags for alloc_contig_range() instead of passing in a 
(weird) migratetype?

Then, we should make sure that we warn if we try a CMA allocation on any 
pageblock that is not of type CMA.

I'm trying to remember what happens if we try offlining a memory region 
that is of type MIGRATE_CMA right now ... I remember that we fail it. We 
should make sure that is still the case, otherwise we could seriously 
break something.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ