From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>,
Dave Hansen <dave.hansen@intel.com>, Mel Gorman <mgorman@suse.de>,
Rik van Riel <riel@redhat.com>, Vlastimil Babka <vbabka@suse.cz>,
Christoph Lameter <cl@gentwo.org>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Steve Capper <steve.capper@linaro.org>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>,
Jerome Marchand <jmarchan@redhat.com>,
Sasha Levin <sasha.levin@oracle.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/4] rmap: introduce rmap_walk_locked()
Date: Thu, 4 Feb 2016 16:37:37 +0200 [thread overview]
Message-ID: <20160204143737.GC20399@node.shutemov.name> (raw)
In-Reply-To: <20160203145607.ec7fe6f46208a5da1a8f795a@linux-foundation.org>
On Wed, Feb 03, 2016 at 02:56:07PM -0800, Andrew Morton wrote:
> On Thu, 4 Feb 2016 01:45:07 +0300 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> wrote:
>
> > On Wed, Feb 03, 2016 at 02:40:19PM -0800, Andrew Morton wrote:
> > > On Wed, 3 Feb 2016 18:14:16 +0300 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> wrote:
> > >
> > > > rmap_walk_locked() is the same as rmap_walk(), but caller takes care
> > > > about relevant rmap lock. It only supports anonymous pages for now.
> > > >
> > > > It's preparation to switch THP splitting from custom rmap walk in
> > > > freeze_page()/unfreeze_page() to generic one.
> > > >
> > > > ...
> > > >
> > > > +/* Like rmap_walk, but caller holds relevant rmap lock */
> > > > +int rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc)
> > > > +{
> > > > + /* only for anon pages for now */
> > > > + VM_BUG_ON_PAGE(!PageAnon(page) || PageKsm(page), page);
> > > > + return rmap_walk_anon(page, rwc, true);
> > > > +}
> > >
> > > Should be rmap_walk_anon_locked()?
> >
> > I leave interface open for further extension for file mappings, once it
> > will be needed. Interface is mirroring plain rmap_walk()
>
> hm, yes, I see.
>
> > If you prefer to rename the function, I can do it too.
>
> Well, what does "unlocked" mean in the context of rmap_walk_ksm() and
> rmap_walk_file()?
For rmap_walk_file(), caller should take i_mmap_lock for page->mapping at
least for read.
Not sure about KSM..
> That the caller holds totally different locks. I expect that sitting
> down and writing out the interface definition for such an
> rmap_walk_locked() would reveal that we shouldn't have created it.
>
> I mean, if the caller is to call such an rmap_walk_locked(), he first
> needs to work out if it's a ksm page or an anon page or a file page,
> then take the appropriate lock and then call rmap_walk_locked().
> That's silly - at this point he should directly call
> rmap_walk_ksm_locked()?
It makes sense if you have multiple pages to process and it's known that
they share reverse mapping.
Or if you want to keep the reverse mapping locked to keep continuity with
other operations.
In THP case, we have 512 subpages to unmap and we want to keep anon_vma
locked until the THP is split.
--
Kirill A. Shutemov
--
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>
next prev parent reply other threads:[~2016-02-04 14:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 15:14 [PATCH 0/4] thp: simplify freeze_page() and unfreeze_page() Kirill A. Shutemov
2016-02-03 15:14 ` [PATCH 1/4] rmap: introduce rmap_walk_locked() Kirill A. Shutemov
2016-02-03 22:40 ` Andrew Morton
2016-02-03 22:45 ` Kirill A. Shutemov
2016-02-03 22:56 ` Andrew Morton
2016-02-04 14:37 ` Kirill A. Shutemov [this message]
2016-02-03 15:14 ` [PATCH 2/4] rmap: extend try_to_unmap() to be usable by split_huge_page() Kirill A. Shutemov
2016-02-03 15:14 ` [PATCH 3/4] mm: make remove_migration_ptes() beyond mm/migration.c Kirill A. Shutemov
2016-02-03 15:14 ` [PATCH 4/4] thp: rewrite freeze_page()/unfreeze_page() with generic rmap walkers Kirill A. Shutemov
2016-02-03 15:42 ` Dave Hansen
2016-02-03 22:43 ` Andrew Morton
2016-02-03 22:53 ` Kirill A. Shutemov
2016-02-04 14:27 ` Kirill A. Shutemov
2016-02-04 23:58 ` Kirill A. Shutemov
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=20160204143737.GC20399@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=cl@gentwo.org \
--cc=dave.hansen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jmarchan@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=riel@redhat.com \
--cc=sasha.levin@oracle.com \
--cc=steve.capper@linaro.org \
--cc=vbabka@suse.cz \
/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).