From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Johannes Weiner <jweiner@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH 2/3] mm: replace per-cpu lru-add page-vectors with page-lists
Date: Mon, 20 Feb 2012 20:21:14 +0400 [thread overview]
Message-ID: <4F4272FA.9000004@openvz.org> (raw)
In-Reply-To: <20120219212417.16861.63119.stgit@zurg>
Konstantin Khlebnikov wrote:
> This patch replaces page-vectors with page-lists in lru_cache_add*() functions.
> We can use page->lru for linking because page obviously not in lru.
>
> Now per-cpu batch limited with its pages total size, not pages count,
> otherwise it can be extremely huge if there many huge-pages inside:
> PAGEVEC_SIZE * HPAGE_SIZE = 28Mb, per-cpu!
> These pages are hidden from memory reclaimer for a while.
> New limit: LRU_CACHE_ADD_BATCH = 64 (* PAGE_SIZE = 256Kb)
>
> So, huge-page adding now will always drain per-cpu list. Huge-page allocation
> and preparation is long procedure, thus nobody will notice this draining.
>
> Draining procedure disables preemption only for pages list isolation,
> thus batch size can be increased without negative effect for latency.
>
> Plus this patch introduces new function lru_cache_add_list() and use it in
> mpage_readpages() and read_pages(). There pages already collected in list.
> Unlike to single-page lru-add, list-add reuse page-referencies from caller,
> thus we save one page_get()/page_put() per page.
>
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
> fs/mpage.c | 21 +++++++----
> include/linux/swap.h | 2 +
> mm/readahead.c | 15 +++++---
> mm/swap.c | 99 +++++++++++++++++++++++++++++++++++++++++++++-----
> 4 files changed, 114 insertions(+), 23 deletions(-)
>
>
> pvec =&per_cpu(lru_rotate_pvecs, cpu);
> @@ -765,6 +841,11 @@ EXPORT_SYMBOL(pagevec_lookup_tag);
> void __init swap_setup(void)
> {
> unsigned long megs = totalram_pages>> (20 - PAGE_SHIFT);
> + int cpu, lru;
> +
> + for_each_possible_cpu(cpu)
> + for_each_lru(lru)
> + INIT_LIST_HEAD(per_cpu(lru_add_pages, cpu) + lru);
As I afraid, here is is too late for this initialization.
This must be in core-initcall.
I'll send v2 together with update lru-lock splitting rebased to linux-next.
>
> #ifdef CONFIG_SWAP
> bdi_init(swapper_space.backing_dev_info);
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Johannes Weiner <jweiner@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH 2/3] mm: replace per-cpu lru-add page-vectors with page-lists
Date: Mon, 20 Feb 2012 20:21:14 +0400 [thread overview]
Message-ID: <4F4272FA.9000004@openvz.org> (raw)
In-Reply-To: <20120219212417.16861.63119.stgit@zurg>
Konstantin Khlebnikov wrote:
> This patch replaces page-vectors with page-lists in lru_cache_add*() functions.
> We can use page->lru for linking because page obviously not in lru.
>
> Now per-cpu batch limited with its pages total size, not pages count,
> otherwise it can be extremely huge if there many huge-pages inside:
> PAGEVEC_SIZE * HPAGE_SIZE = 28Mb, per-cpu!
> These pages are hidden from memory reclaimer for a while.
> New limit: LRU_CACHE_ADD_BATCH = 64 (* PAGE_SIZE = 256Kb)
>
> So, huge-page adding now will always drain per-cpu list. Huge-page allocation
> and preparation is long procedure, thus nobody will notice this draining.
>
> Draining procedure disables preemption only for pages list isolation,
> thus batch size can be increased without negative effect for latency.
>
> Plus this patch introduces new function lru_cache_add_list() and use it in
> mpage_readpages() and read_pages(). There pages already collected in list.
> Unlike to single-page lru-add, list-add reuse page-referencies from caller,
> thus we save one page_get()/page_put() per page.
>
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
> fs/mpage.c | 21 +++++++----
> include/linux/swap.h | 2 +
> mm/readahead.c | 15 +++++---
> mm/swap.c | 99 +++++++++++++++++++++++++++++++++++++++++++++-----
> 4 files changed, 114 insertions(+), 23 deletions(-)
>
>
> pvec =&per_cpu(lru_rotate_pvecs, cpu);
> @@ -765,6 +841,11 @@ EXPORT_SYMBOL(pagevec_lookup_tag);
> void __init swap_setup(void)
> {
> unsigned long megs = totalram_pages>> (20 - PAGE_SHIFT);
> + int cpu, lru;
> +
> + for_each_possible_cpu(cpu)
> + for_each_lru(lru)
> + INIT_LIST_HEAD(per_cpu(lru_add_pages, cpu) + lru);
As I afraid, here is is too late for this initialization.
This must be in core-initcall.
I'll send v2 together with update lru-lock splitting rebased to linux-next.
>
> #ifdef CONFIG_SWAP
> bdi_init(swapper_space.backing_dev_info);
>
next prev parent reply other threads:[~2012-02-20 16:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-19 21:24 [PATCH 1/3] mm: drain percpu lru add/rotate page-vectors on cpu hot-unplug Konstantin Khlebnikov
2012-02-19 21:24 ` Konstantin Khlebnikov
2012-02-19 21:24 ` [PATCH 2/3] mm: replace per-cpu lru-add page-vectors with page-lists Konstantin Khlebnikov
2012-02-19 21:24 ` Konstantin Khlebnikov
2012-02-20 16:21 ` Konstantin Khlebnikov [this message]
2012-02-20 16:21 ` Konstantin Khlebnikov
2012-02-19 21:24 ` [PATCH 3/3] mm: deprecate pagevec lru-add functions Konstantin Khlebnikov
2012-02-19 21:24 ` Konstantin Khlebnikov
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=4F4272FA.9000004@openvz.org \
--to=khlebnikov@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jweiner@redhat.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.