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]
Date:   Tue, 6 Jun 2023 09:44:38 +0200
From:   David Hildenbrand <david@...hat.com>
To:     mpenttil@...hat.com, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org
Cc:     Alistair Popple <apopple@...dia.com>,
        John Hubbard <jhubbard@...dia.com>,
        Ralph Campbell <rcampbell@...dia.com>,
        "Huang, Ying" <ying.huang@...el.com>
Subject: Re: [PATCH v3] mm/migrate_device: Try to handle swapcache pages

On 06.06.23 07:01, mpenttil@...hat.com wrote:
> From: Mika Penttilä <mpenttil@...hat.com>
> 
> Migrating file pages and swapcache pages into device memory is not supported.
> The decision is done based on page_mapping(). For now, swapcache pages are not migrated.
> 
> Things can however be improved, for swapcache pages. Try to get rid of the swap cache,
> and if successful, go ahead as with other anonymous pages.
> 
> Cc: Alistair Popple <apopple@...dia.com>
> Cc: John Hubbard <jhubbard@...dia.com>
> Cc: Ralph Campbell <rcampbell@...dia.com>
> Cc: "Huang, Ying" <ying.huang@...el.com>
> Reviewed-by: "Huang, Ying" <ying.huang@...el.com>
> Reviewed-by: Alistair Popple <apopple@...dia.com>
> Signed-off-by: Mika Penttilä <mpenttil@...hat.com>
> ---
> 
> v3:
>    - Adjust comments
>    - Add Reviewed-bys
> 
> v2:
>    - use folio_test_anon() (Huang, Ying)
> 
>   mm/migrate_device.c | 22 ++++++++++++++++------
>   1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index d30c9de60b0d..f76ebccfe067 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -747,13 +747,23 @@ static void __migrate_device_pages(unsigned long *src_pfns,
>   
>   		if (is_device_private_page(newpage) ||
>   		    is_device_coherent_page(newpage)) {
> -			/*
> -			 * For now only support anonymous memory migrating to
> -			 * device private or coherent memory.
> -			 */
> +
>   			if (mapping) {
> -				src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
> -				continue;
> +				struct folio *folio;
> +
> +				folio = page_folio(page);
> +
> +				/*
> +				 * For now only support anonymous memory migrating to
> +				 * device private or coherent memory.
> +				 *
> +				 * Try to get rid of swap cache if possible.
> +				 *
> +				 */
> +				if (!folio_test_anon(folio) || !folio_free_swap(folio)) {
> +					src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
> +					continue;

I'm pretty sure the folio has to be locked in order to call 
folio_free_swap().

-- 
Cheers,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ