From: Mike Rapoport <rppt@kernel.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/5] mm: Add vma_alloc_zeroed_movable_folio()
Date: Thu, 19 Jan 2023 12:16:12 +0200 [thread overview]
Message-ID: <Y8kYbL5rZswU++NN@kernel.org> (raw)
In-Reply-To: <20230116191813.2145215-2-willy@infradead.org>
On Mon, Jan 16, 2023 at 07:18:09PM +0000, Matthew Wilcox (Oracle) wrote:
> Replace alloc_zeroed_user_highpage_movable(). The main difference is
> returning a folio containing a single page instead of returning the
> page, but take the opportunity to rename the function to match other
> allocation functions a little better and rewrite the documentation
> to place more emphasis on the zeroing rather than the highmem aspect.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> arch/alpha/include/asm/page.h | 5 ++---
> arch/arm64/include/asm/page.h | 4 ++--
> arch/arm64/mm/fault.c | 4 ++--
> arch/ia64/include/asm/page.h | 14 ++++++--------
> arch/m68k/include/asm/page_no.h | 5 ++---
> arch/s390/include/asm/page.h | 5 ++---
> arch/x86/include/asm/page.h | 5 ++---
> include/linux/highmem.h | 33 ++++++++++++++++-----------------
> mm/memory.c | 16 ++++++++++------
> 9 files changed, 44 insertions(+), 47 deletions(-)
...
> diff --git a/include/linux/highmem.h b/include/linux/highmem.h
> index 56703082f803..9fa462561e05 100644
> --- a/include/linux/highmem.h
> +++ b/include/linux/highmem.h
> @@ -208,31 +208,30 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
> }
> #endif
>
> -#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE
> +#ifndef vma_alloc_zeroed_movable_folio
> /**
> - * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move
> - * @vma: The VMA the page is to be allocated for
> - * @vaddr: The virtual address the page will be inserted into
> + * vma_alloc_zeroed_movable_folio - Allocate a zeroed page for a VMA.
> + * @vma: The VMA the page is to be allocated for.
> + * @vaddr: The virtual address the page will be inserted into.
> *
> - * Returns: The allocated and zeroed HIGHMEM page
> + * This function will allocate a page suitable for inserting into this
> + * VMA at this virtual address. It may be allocated from highmem or
> + * the movable zone. An architecture may provide its own implementation.
> *
> - * This function will allocate a page for a VMA that the caller knows will
> - * be able to migrate in the future using move_pages() or reclaimed
> - *
> - * An architecture may override this function by defining
> - * __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE and providing their own
> - * implementation.
> + * Return: A folio containing one allocated and zeroed page or NULL if
> + * we are out of memory.
> */
> -static inline struct page *
> -alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
> +static inline
> +struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
> unsigned long vaddr)
> {
> - struct page *page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr);
> + struct folio *folio;
>
> - if (page)
> - clear_user_highpage(page, vaddr);
> + folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr, false);
Add __GFP_ZERO and simply return vma_alloc_folio(...)?
> + if (folio)
> + clear_user_highpage(&folio->page, vaddr);
>
> - return page;
> + return folio;
> }
> #endif
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2023-01-19 10:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 19:18 [PATCH 0/5] Convert various functions in memory.c to use folios Matthew Wilcox (Oracle)
2023-01-16 19:18 ` [PATCH 1/5] mm: Add vma_alloc_zeroed_movable_folio() Matthew Wilcox (Oracle)
2023-01-19 10:16 ` Mike Rapoport [this message]
2023-01-19 13:57 ` Matthew Wilcox
2023-01-19 18:22 ` Zi Yan
2023-01-16 19:18 ` [PATCH 2/5] mm: Convert do_anonymous_page() to use a folio Matthew Wilcox (Oracle)
2023-01-19 18:23 ` Zi Yan
2023-01-16 19:18 ` [PATCH 3/5] mm: Convert wp_page_copy() to use folios Matthew Wilcox (Oracle)
2023-01-19 18:29 ` Zi Yan
2023-01-16 19:18 ` [PATCH 4/5] mm: Use a folio in copy_pte_range() Matthew Wilcox (Oracle)
2023-01-19 18:32 ` Zi Yan
2023-01-16 19:18 ` [PATCH 5/5] mm: Use a folio in copy_present_pte() Matthew Wilcox (Oracle)
2023-01-19 18:33 ` Zi Yan
2023-01-21 9:22 ` [PATCH 0/5] Convert various functions in memory.c to use folios Mike Rapoport
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=Y8kYbL5rZswU++NN@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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