From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>, Michal Hocko <mhocko@suse.cz>,
Mel Gorman <mgorman@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v2] mm, hugetlb: set PageLRU for in-use/active hugepages
Date: Wed, 18 Feb 2015 00:18:39 +0000 [thread overview]
Message-ID: <20150218001824.GB4823@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20150217155744.04db5a98d5a1820240eb2317@linux-foundation.org>
On Tue, Feb 17, 2015 at 03:57:44PM -0800, Andrew Morton wrote:
> On Tue, 17 Feb 2015 09:32:08 +0000 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
>
> > Currently we are not safe from concurrent calls of isolate_huge_page(),
> > which can make the victim hugepage in invalid state and results in BUG_ON().
> >
> > The root problem of this is that we don't have any information on struct page
> > (so easily accessible) about the hugepage's activeness. Note that hugepages'
> > activeness means just being linked to hstate->hugepage_activelist, which is
> > not the same as normal pages' activeness represented by PageActive flag.
> >
> > Normal pages are isolated by isolate_lru_page() which prechecks PageLRU before
> > isolation, so let's do similarly for hugetlb. PageLRU is unused on hugetlb now,
> > so the change is mostly just inserting Set/ClearPageLRU (no conflict with
> > current usage.) And the other changes are justified like below:
> > - __put_compound_page() calls __page_cache_release() to do some LRU works,
> > but this is obviously for thps and assumes that hugetlb has always !PageLRU.
> > This assumption is not true any more, so this patch simply adds if (!PageHuge)
> > to avoid calling __page_cache_release() for hugetlb.
> > - soft_offline_huge_page() now just calls list_move(), but generally callers
> > of page migration should use the common routine in isolation, so let's
> > replace the list_move() with isolate_huge_page() rather than inserting
> > ClearPageLRU.
> >
> > Set/ClearPageLRU should be called within hugetlb_lock, but hugetlb_cow() and
> > hugetlb_no_page() don't do this. This is justified because in these function
> > SetPageLRU is called right after the hugepage is allocated and no other thread
> > tries to isolate it.
>
> Whoa.
>
> So if I'm understanding this correctly, hugepages never have PG_lru set
> and so you are overloading that bit on hugepages to indicate that the
> page is present on hstate->hugepage_activelist?
Right, that's my intention.
> This is somewhat of a big deal and the patch doesn't make it very clear
> at all. We should
>
> - document PG_lru, for both of its identities
OK, I'll do this.
> - consider adding a new PG_hugepage_active(?) flag which has the same
> value as PG_lru (see how PG_savepinned was done).
I thought of this at first, but didn't do just to avoid complexity for
the first patch. I know this is necessary finally, so I'll do this next.
Maybe I'll name it as PG_hugetlb_active, because just stating "hugepage"
might cause some confusion between hugetlb and thp in the future.
> - create suitable helper functions for the new PG_lru meaning.
> Simply calling PageLRU/SetPageLRU for pages which *aren't on the LRU*
> is lazy and misleading. Create a name for the new concept
> (hugepage_active?) and document it and use it consistently.
OK.
>
> > @@ -75,7 +76,8 @@ static void __put_compound_page(struct page *page)
> > {
> > compound_page_dtor *dtor;
> >
> > - __page_cache_release(page);
> > + if (!PageHuge(page))
> > + __page_cache_release(page);
> > dtor = get_compound_page_dtor(page);
> > (*dtor)(page);
>
> And this needs a good comment - there's no way that a reader can work
> out why this code is here unless he goes dumpster diving in the git
> history.
OK.
Thanks,
Naoya Horiguchi
--
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:[~2015-02-18 0:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 3:22 [PATCH] " Naoya Horiguchi
2015-02-17 9:32 ` [PATCH v2] " Naoya Horiguchi
2015-02-17 23:57 ` Andrew Morton
2015-02-18 0:02 ` Andrew Morton
2015-02-18 1:07 ` Naoya Horiguchi
2015-02-18 0:18 ` Naoya Horiguchi [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=20150218001824.GB4823@hori1.linux.bs1.fc.nec.co.jp \
--to=n-horiguchi@ah.jp.nec.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=nao.horiguchi@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