From: Mel Gorman <mgorman@suse.de>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Minchan Kim <minchan.kim@gmail.com>, Mel Gorman <mel@csn.ul.ie>,
akpm@linux-foundation.org, Ury Stankevich <urykhy@gmail.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: compaction: Abort compaction if too many pages are isolated and caller is asynchronous
Date: Mon, 6 Jun 2011 15:47:34 +0100 [thread overview]
Message-ID: <20110606144734.GF5247@suse.de> (raw)
In-Reply-To: <20110606124954.GC12887@random.random>
On Mon, Jun 06, 2011 at 02:49:54PM +0200, Andrea Arcangeli wrote:
> On Mon, Jun 06, 2011 at 11:32:16AM +0100, Mel Gorman wrote:
> > This patch is pulling in stuff from Minchan. Minimally his patch should
> > be kept separate to preserve history or his Signed-off should be
> > included on this patch.
>
> Well I didn't apply Minchan's patch, just improved it as he suggested
> from pseudocode, but I can add his signed-off-by no prob.
>
My bad, the pseudo-code was close enough to being a patch I felt it at
least merited a mention in the patch.
> > I still think this optimisation is rare and only applies if we are
> > encountering huge pages during the linear scan. How often are we doing
> > that really?
>
> Well it's so fast to do it, that it looks worthwhile. You probably
> noticed initially I suggested only the fix for page_count
> (theoretical) oops, and I argued we could improve some more bits, but
> then it was kind of obvious to improve the upper side of the loop too
> according to pseudocode.
>
I don't feel very strongly about it. I don't think there is much of a
boost because of how rarely we'll encounter this situation but there is
no harm either. I think the page_count fix is more important.
> >
> > > + VM_BUG_ON(!isolated_pages);
> >
> > This BUG_ON is overkill. hpage_nr_pages would have to return 0.
> >
> > > + VM_BUG_ON(isolated_pages > MAX_ORDER_NR_PAGES);
> >
> > This would require order > MAX_ORDER_NR_PAGES to be passed into
> > isolate_lru_pages or for a huge page to be unaligned to a power of
> > two. The former is very unlikely and the latter is not supported by
> > any CPU.
>
> Minchan also disliked the VM_BUG_ON, it's clearly way overkill, but
> frankly the pfn physical scans are tricky enough things and if there's
> a race and the order is wrong for whatever reason (no compound page or
> overwritten by driver messing with subpages) we'll just trip into some
> weird pointer next iteration (or maybe not and it'll go ahead
> unnoticed if it's not beyond the range) and in that case I'd like to
> notice immediately.
>
I guess there is always the chance that an out-of-tree driver will
do something utterly insane with a transparent hugepage and while
this BUG_ON is "impossible", it doesn't hurt either.
> But probably it's too paranoid even of a VM_BUG_ON so I surely can
> remove it...
>
> >
> > > } else {
> > > - /* the page is freed already. */
> > > - if (!page_count(cursor_page))
> > > + /*
> > > + * Check if the page is freed already.
> > > + *
> > > + * We can't use page_count() as that
> > > + * requires compound_head and we don't
> > > + * have a pin on the page here. If a
> > > + * page is tail, we may or may not
> > > + * have isolated the head, so assume
> > > + * it's not free, it'd be tricky to
> > > + * track the head status without a
> > > + * page pin.
> > > + */
> > > + if (!PageTail(cursor_page) &&
> > > + !__page_count(cursor_page))
> > > continue;
> > > break;
> >
> > Ack to this part.
>
> This is also the only important part that fixes the potential oops.
>
Agreed.
> > I'm not keen on __page_count() as __ normally means the "unlocked"
> > version of a function although I realise that rule isn't universal
> > either. I can't think of a better name though.
>
> If better suggestions comes to mind I can change it... Or I can also
> use atomic_read like in the first patch... it's up to you.
The atomic_read is not an improvement. What you have is better than
adding another atomic_read to page count.
> I figured
> it wasn't so nice to call atomic_read and there are other places in
> huge_memory.c that used that for bugchecks and it can be cleaned up
> with __page_count. The _count having _ prefix is the thing that makes
> it look like a more private field not to use in generic VM code so the
> raw value can be altered without changing all callers of __page_count
> similar to _mapcount.
There is that. Go with __page_count because it's better than an
atomic_read. I'm happy to ack the __page_count part of this patch so
please split it out because it is a -stable candidate where as the
potential optimisation and VM_BUG_ONs are not.
--
Mel Gorman
SUSE Labs
--
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>
next prev parent reply other threads:[~2011-06-06 14:47 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-30 13:13 Mel Gorman
2011-05-30 14:31 ` Andrea Arcangeli
2011-05-30 15:37 ` Mel Gorman
2011-05-30 16:55 ` Mel Gorman
2011-05-30 17:53 ` Andrea Arcangeli
2011-05-31 12:16 ` Minchan Kim
2011-05-31 12:24 ` Andrea Arcangeli
2011-05-31 13:33 ` Minchan Kim
2011-05-31 14:14 ` Andrea Arcangeli
2011-05-31 14:37 ` Minchan Kim
2011-05-31 14:38 ` Minchan Kim
2011-06-02 18:23 ` Andrea Arcangeli
2011-06-02 20:21 ` Minchan Kim
2011-06-02 20:59 ` Minchan Kim
2011-06-02 22:03 ` Andrea Arcangeli
2011-06-02 21:40 ` Andrea Arcangeli
2011-06-02 22:23 ` Minchan Kim
2011-06-02 22:32 ` Andrea Arcangeli
2011-06-02 23:01 ` Minchan Kim
2011-06-03 17:37 ` Andrea Arcangeli
2011-06-03 18:07 ` Andrea Arcangeli
2011-06-04 7:59 ` Minchan Kim
2011-06-06 10:32 ` Mel Gorman
2011-06-06 12:49 ` Andrea Arcangeli
2011-06-06 14:47 ` Mel Gorman [this message]
2011-06-06 14:07 ` Minchan Kim
2011-06-06 10:15 ` Mel Gorman
2011-06-06 10:26 ` Mel Gorman
2011-06-06 14:01 ` Minchan Kim
2011-06-06 14:26 ` Minchan Kim
2011-06-02 23:02 ` Minchan Kim
2011-06-01 0:57 ` Mel Gorman
2011-06-01 9:24 ` Mel Gorman
2011-06-01 17:58 ` Mel Gorman
2011-06-01 19:15 ` Andrea Arcangeli
2011-06-01 21:40 ` Mel Gorman
2011-06-01 23:30 ` Andrea Arcangeli
2011-06-02 1:03 ` Mel Gorman
2011-06-02 8:34 ` Minchan Kim
2011-06-02 13:29 ` Andrea Arcangeli
2011-06-02 14:50 ` Mel Gorman
2011-06-02 15:37 ` Andrea Arcangeli
2011-06-03 2:09 ` Mel Gorman
2011-06-03 14:49 ` Mel Gorman
2011-06-03 15:45 ` Andrea Arcangeli
2011-06-04 7:25 ` Minchan Kim
2011-06-06 10:39 ` Mel Gorman
2011-06-06 12:38 ` Andrea Arcangeli
2011-06-06 14:55 ` Mel Gorman
2011-06-06 14:19 ` Minchan Kim
2011-06-06 22:32 ` Andrew Morton
2011-06-04 6:58 ` Minchan Kim
2011-06-06 10:43 ` Mel Gorman
2011-06-06 12:40 ` Andrea Arcangeli
2011-06-06 13:27 ` Minchan Kim
2011-06-06 13:23 ` Minchan Kim
2011-05-31 14:34 ` Mel Gorman
2011-05-30 14:45 ` [stable] " Greg KH
2011-05-30 16:14 ` Minchan Kim
2011-05-31 8:32 ` Mel Gorman
2011-05-31 4:48 ` KAMEZAWA Hiroyuki
2011-05-31 5:38 ` Minchan Kim
2011-05-31 7:14 ` KOSAKI Motohiro
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=20110606144734.GF5247@suse.de \
--to=mgorman@suse.de \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=urykhy@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox