From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] mm/pagewalk: replace mm_walk->skip with more general mm_walk->control
Date: Mon, 9 Jun 2014 17:29:01 -0400 [thread overview]
Message-ID: <5396272b.21efc20a.2ac8.2134SMTPIN_ADDED_BROKEN@mx.google.com> (raw)
In-Reply-To: <539612A8.8080303@intel.com>
On Mon, Jun 09, 2014 at 01:01:44PM -0700, Dave Hansen wrote:
> On 06/06/2014 03:58 PM, Naoya Horiguchi wrote:
> > +enum mm_walk_control {
> > + PTWALK_NEXT = 0, /* Go to the next entry in the same level or
> > + * the next vma. This is default behavior. */
> > + PTWALK_DOWN, /* Go down to lower level */
> > + PTWALK_BREAK, /* Break current loop and continue from the
> > + * next loop */
> > +};
>
> I think this is a bad idea.
>
> The page walker should be for the common cases of walking page tables,
> and it should be simple. It *HAS* to be better (shorter/faster) than if
> someone was to just open-code a page table walk, or it's not really useful.
>
> The only place this is used is in the ppc walker, and it saves a single
> line of code, but requires some comments to explain what is going on:
>
> arch/powerpc/mm/subpage-prot.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> So, it adds infrastructure, but saves a single line of code. Seems like
> a bad trade off to me. :(
Right, thank you.
What I felt uneasy was that after moving pmd locking into common code,
we need unlock/re-lock before/after split_huge_page_pmd() like this:
static int subpage_walk_pmd_entry(pmd_t *pmd, unsigned long addr,
unsigned long end, struct mm_walk *walk)
{
struct vm_area_struct *vma = walk->vma;
+ spin_unlock(walk->ptl);
split_huge_page_pmd(vma, addr, pmd);
+ spin_lock(walk->ptl);
return 0;
}
I thought it's straightforward but dirty, but my workaround in this patch
was dirty too. So I'm fine to give up the control stuff and take this one.
BTW after moving pmd locking, PTWALK_DOWN is used only by walk_page_test()
and ->test_walk(), so we can completely remove ->skip by giving that role
to the positive value of the return value. It's cleaner.
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>
next prev parent reply other threads:[~2014-06-09 21:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 22:58 [PATCH -mm 0/7] mm/pagewalk: standardize current users, move pmd locking, apply to mincore Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 1/7] mm/pagewalk: remove pgd_entry() and pud_entry() Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 2/7] mm/pagewalk: replace mm_walk->skip with more general mm_walk->control Naoya Horiguchi
2014-06-09 20:01 ` Dave Hansen
2014-06-09 21:29 ` Naoya Horiguchi [this message]
[not found] ` <1402349339-n9udlcv2@n-horiguchi@ah.jp.nec.com>
2014-06-09 21:51 ` Dave Hansen
2014-06-06 22:58 ` [PATCH 3/7] madvise: cleanup swapin_walk_pmd_entry() Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 4/7] memcg: separate mem_cgroup_move_charge_pte_range() Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 5/7] arch/powerpc/mm/subpage-prot.c: cleanup subpage_walk_pmd_entry() Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 6/7] mm/pagewalk: move pmd_trans_huge_lock() from callbacks to common code Naoya Horiguchi
2014-06-09 20:04 ` Dave Hansen
2014-06-09 21:35 ` Naoya Horiguchi
2014-06-06 22:58 ` [PATCH 7/7] mincore: apply page table walker on do_mincore() Naoya Horiguchi
2014-06-12 22:04 ` Andrew Morton
2014-06-12 23:33 ` Naoya Horiguchi
2014-06-16 15:24 ` Sasha Levin
2014-06-16 16:44 ` Naoya Horiguchi
2014-06-16 21:14 ` Sasha Levin
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=5396272b.21efc20a.2ac8.2134SMTPIN_ADDED_BROKEN@mx.google.com \
--to=n-horiguchi@ah.jp.nec.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hughd@google.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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