From: Wu Fengguang <fengguang.wu@intel.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Bob Liu <lliubbo@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"mel@csn.ul.ie" <mel@csn.ul.ie>,
"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [PATCH] memory-hotplug: only drain LRU when failed to offline pages
Date: Mon, 25 Oct 2010 13:28:18 +0800 [thread overview]
Message-ID: <20101025052818.GA23237@localhost> (raw)
In-Reply-To: <20101025141519.7fd32b1c.kamezawa.hiroyu@jp.fujitsu.com>
On Mon, Oct 25, 2010 at 01:15:19PM +0800, KAMEZAWA Hiroyuki wrote:
> On Mon, 25 Oct 2010 13:12:02 +0800
> Wu Fengguang <fengguang.wu@intel.com> wrote:
>
> > do_migrate_range() offlines 1MB pages at one time and hence might be
> > called up to 16000 times when trying to offline 16GB memory.
>
> But size of memory section is not such big.
It's NR_OFFLINE_AT_ONCE_PAGES=256 (1MB).
> > It makes sense to avoid sending the costly IPIs to drain pages on all LRU for
> > the 99% cases that do_migrate_range() succeeds offlining some pages.
> >
>
> did you test ? I think this patch should be tested by IBM guys.
Only compile tested..
> > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
>
> Sorry, this will HUNK. Could you wait until the end of merge window ?
OK, I'll resend.
>
> > ---
> > mm/memory_hotplug.c | 24 ++++++++++--------------
> > 1 file changed, 10 insertions(+), 14 deletions(-)
> >
> > --- linux-next.orig/mm/memory_hotplug.c 2010-10-25 11:20:47.000000000 +0800
> > +++ linux-next/mm/memory_hotplug.c 2010-10-25 13:07:10.000000000 +0800
> > @@ -788,7 +788,7 @@ static int offline_pages(unsigned long s
> > {
> > unsigned long pfn, nr_pages, expire;
> > long offlined_pages;
> > - int ret, drain, retry_max, node;
> > + int ret, retry_max, node;
> > struct zone *zone;
> > struct memory_notify arg;
> >
> > @@ -827,7 +827,6 @@ static int offline_pages(unsigned long s
> >
> > pfn = start_pfn;
> > expire = jiffies + timeout;
> > - drain = 0;
> > retry_max = 5;
> > repeat:
> > /* start memory hot removal */
> > @@ -838,34 +837,31 @@ repeat:
> > if (signal_pending(current))
> > goto failed_removal;
> > ret = 0;
> > - if (drain) {
> > - lru_add_drain_all();
> > - flush_scheduled_work();
>
> this flush_scheduled_work() is removed in recent work of Tejun Heo.
Ah yes.
> > - cond_resched();
> > - drain_all_pages();
> > - }
> > -
> > pfn = scan_lru_pages(start_pfn, end_pfn);
> > if (pfn) { /* We have page on LRU */
> > ret = do_migrate_range(pfn, end_pfn);
> > if (!ret) {
> > - drain = 1;
> > goto repeat;
> > } else {
> > if (ret < 0)
> > if (--retry_max == 0)
> > goto failed_removal;
> > yield();
> > - drain = 1;
> > + lru_add_drain_all();
> > + flush_scheduled_work();
> This flush is unnecessary.
OK.
> > + cond_resched();
> > + drain_all_pages();
>
> I think followin is better order.
>
> drain_all_pages(); # SEND IPI and asynchronous.
> lru_add_drain_pages(); # call schedule_work ony by one and it's synchronous.
> cond_resched(); # may not be unnecessary (lru_add_drain_pages() will sleep.)
That looks better. I'll remove cond_resched() too.
> > goto repeat;
> > }
> > }
> > - /* drain all zone's lru pagevec, this is asyncronous... */
> > +
> > + /* drain all zone's lru pagevec, this is asynchronous... */
> > lru_add_drain_all();
> > flush_scheduled_work();
> This flush() is dropped by recent works of Tejun Heo's workqueue updates.
OK.
Thanks,
Fengguang
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2010-10-25 5:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 5:12 [PATCH] memory-hotplug: only drain LRU when failed to offline pages Wu Fengguang
2010-10-25 5:15 ` KAMEZAWA Hiroyuki
2010-10-25 5:28 ` Wu Fengguang [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=20101025052818.GA23237@localhost \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=lliubbo@gmail.com \
--cc=mel@csn.ul.ie \
/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;
as well as URLs for NNTP newsgroup(s).