linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  Johannes Weiner <hannes@cmpxchg.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH 2/4] slab: Convert __kmalloc_large_node() and free_large_kmalloc() to use folios
Date: Sat, 23 Dec 2023 08:11:11 +0900	[thread overview]
Message-ID: <CAB=+i9TeoeeAXcb7Q_z3=vmNgQC-8A01YkJpU+S=XUnuNMXOmg@mail.gmail.com> (raw)
In-Reply-To: <20231222202807.2135717-3-willy@infradead.org>

On Sat, Dec 23, 2023 at 5:28 AM Matthew Wilcox (Oracle)
<willy@infradead.org> wrote:
>
> Add folio_alloc_node() to replace alloc_pages_node() and then use
> folio APIs throughout instead of converting back to pages.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
[...]
> diff --git a/mm/slub.c b/mm/slub.c
> index 35aa706dc318..261f01915d9b 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3919,18 +3919,17 @@ EXPORT_SYMBOL(kmem_cache_alloc_node);
>   */
>  static void *__kmalloc_large_node(size_t size, gfp_t flags, int node)
>  {
> -       struct page *page;
> +       struct folio *folio;
>         void *ptr = NULL;
>         unsigned int order = get_order(size);
>
>         if (unlikely(flags & GFP_SLAB_BUG_MASK))
>                 flags = kmalloc_fix_flags(flags);
>
> -       flags |= __GFP_COMP;
> -       page = alloc_pages_node(node, flags, order);
> -       if (page) {
> -               ptr = page_address(page);
> -               mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B,
> +       folio = folio_alloc_node(flags, order, node);

folio_alloc_node()
->__folio_alloc_node()
->__folio_alloc()
->page_rmappable_folio()
->folio_prep_large_rmappable()

I think it's not intentional to call this?

> +       if (folio) {
> +               ptr = folio_address(folio);
> +               lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B,
>                                       PAGE_SIZE << order);
>         }

Thanks,
Hyeonggon


  reply	other threads:[~2023-12-22 23:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 20:28 [PATCH 0/4] Remove some lruvec page accounting functions Matthew Wilcox (Oracle)
2023-12-22 20:28 ` [PATCH 1/4] mm: Remove inc/dec lruvec page state functions Matthew Wilcox (Oracle)
2023-12-22 20:28 ` [PATCH 2/4] slab: Convert __kmalloc_large_node() and free_large_kmalloc() to use folios Matthew Wilcox (Oracle)
2023-12-22 23:11   ` Hyeonggon Yoo [this message]
2023-12-22 23:13     ` Matthew Wilcox
2023-12-23  6:09     ` Matthew Wilcox
2023-12-27 22:01   ` Andrew Morton
2023-12-28  4:15     ` Hyeonggon Yoo
2024-01-02 15:58     ` Vlastimil Babka
2023-12-22 20:28 ` [PATCH 3/4] mm/khugepaged: Use a folio more in collapse_file() Matthew Wilcox (Oracle)
2023-12-22 20:28 ` [PATCH 4/4] mm/memcontrol: Remove __mod_lruvec_page_state() Matthew Wilcox (Oracle)

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='CAB=+i9TeoeeAXcb7Q_z3=vmNgQC-8A01YkJpU+S=XUnuNMXOmg@mail.gmail.com' \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --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