From: Michal Hocko <mhocko@suse.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org, hch@lst.de,
Uladzislau Rezki <urezki@gmail.com>
Subject: Re: [PATCH 1/2] vmalloc: Free pages as a batch
Date: Wed, 23 Sep 2020 10:35:34 +0200 [thread overview]
Message-ID: <20200923083534.GE4887@dhcp22.suse.cz> (raw)
In-Reply-To: <20200921224628.20704-1-willy@infradead.org>
On Mon 21-09-20 23:46:27, Matthew Wilcox wrote:
> Use release_pages() to free the pages allocated by vmalloc(). This is
> slightly more efficient in terms of disabling and enabling IRQs once
> per batch instead of once per page.
Hmm, does this really lead to runtime improvements? Batching IRQ is
certainly nice but release_pages is much more heavy weight and all
additional checks are simply always false for vmalloc pages so all those
checks are pointless.
Maybe storing those pages into the linked list and use
free_unref_page_list instead would achieve what you want?
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> mm/vmalloc.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index be4724b916b3..3893fc8915c4 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2263,16 +2263,8 @@ static void __vunmap(const void *addr, int deallocate_pages)
> vm_remove_mappings(area, deallocate_pages);
>
> if (deallocate_pages) {
> - int i;
> -
> - for (i = 0; i < area->nr_pages; i++) {
> - struct page *page = area->pages[i];
> -
> - BUG_ON(!page);
> - __free_pages(page, 0);
> - }
> + release_pages(area->pages, area->nr_pages);
> atomic_long_sub(area->nr_pages, &nr_vmalloc_pages);
> -
> kvfree(area->pages);
> }
>
> --
> 2.28.0
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2020-09-23 8:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 22:46 Matthew Wilcox (Oracle)
2020-09-21 22:46 ` [PATCH 2/2] vfree: Update documentation Matthew Wilcox (Oracle)
2020-09-22 14:35 ` Christoph Hellwig
2020-09-22 15:06 ` Matthew Wilcox
2020-09-22 15:09 ` Christoph Hellwig
2020-09-22 15:22 ` Matthew Wilcox
2020-09-22 15:31 ` Christoph Hellwig
2020-09-22 16:42 ` Matthew Wilcox
2020-09-23 8:35 ` Michal Hocko [this message]
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=20200923083534.GE4887@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=urezki@gmail.com \
--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