From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@suse.de>, Andi Kleen <andi@firstfloor.org>,
Michal Hocko <mhocko@suse.cz>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Rik van Riel <riel@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
kirill.shutemov@linux.intel.com,
Alex Thorlton <athorlton@sgi.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] hugetlbfs: support split page table lock
Date: Sun, 08 Sep 2013 22:23:55 +0530 [thread overview]
Message-ID: <871u4zi7a4.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1378416466-30913-2-git-send-email-n-horiguchi@ah.jp.nec.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> writes:
> Currently all of page table handling by hugetlbfs code are done under
> mm->page_table_lock. So when a process have many threads and they heavily
> access to the memory, lock contention happens and impacts the performance.
>
> This patch makes hugepage support split page table lock so that we use
> page->ptl of the leaf node of page table tree which is pte for normal pages
> but can be pmd and/or pud for hugepages of some architectures.
>
> ChangeLog v3:
> - disable split ptl for ppc with USE_SPLIT_PTLOCKS_HUGETLB.
> - remove replacement in some architecture dependent code. This is justified
> because an allocation of pgd/pud/pmd/pte entry can race with other
> allocation, not with read/write access, so we can use different locks.
> http://thread.gmane.org/gmane.linux.kernel.mm/106292/focus=106458
>
> ChangeLog v2:
> - add split ptl on other archs missed in v1
> - drop changes on arch/{powerpc,tile}/mm/hugetlbpage.c
>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> include/linux/hugetlb.h | 20 +++++++++++
> include/linux/mm_types.h | 2 ++
> mm/hugetlb.c | 92 +++++++++++++++++++++++++++++-------------------
> mm/mempolicy.c | 5 +--
> mm/migrate.c | 4 +--
> mm/rmap.c | 2 +-
> 6 files changed, 84 insertions(+), 41 deletions(-)
>
> diff --git v3.11-rc3.orig/include/linux/hugetlb.h v3.11-rc3/include/linux/hugetlb.h
> index 0393270..5cb8a4e 100644
> --- v3.11-rc3.orig/include/linux/hugetlb.h
> +++ v3.11-rc3/include/linux/hugetlb.h
> @@ -80,6 +80,24 @@ extern const unsigned long hugetlb_zero, hugetlb_infinity;
> extern int sysctl_hugetlb_shm_group;
> extern struct list_head huge_boot_pages;
>
> +#if USE_SPLIT_PTLOCKS_HUGETLB
> +#define huge_pte_lockptr(mm, ptep) ({__pte_lockptr(virt_to_page(ptep)); })
> +#else /* !USE_SPLIT_PTLOCKS_HUGETLB */
> +#define huge_pte_lockptr(mm, ptep) ({&(mm)->page_table_lock; })
> +#endif /* USE_SPLIT_PTLOCKS_HUGETLB */
> +
> +#define huge_pte_offset_lock(mm, address, ptlp) \
> +({ \
> + pte_t *__pte = huge_pte_offset(mm, address); \
> + spinlock_t *__ptl = NULL; \
> + if (__pte) { \
> + __ptl = huge_pte_lockptr(mm, __pte); \
> + *(ptlp) = __ptl; \
> + spin_lock(__ptl); \
> + } \
> + __pte; \
> +})
why not a static inline function ?
> +
> /* arch callbacks */
>
> pte_t *huge_pte_alloc(struct mm_struct *mm,> @@ -164,6 +182,8 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb,
> BUG();
> }
>
> +#define huge_pte_lockptr(mm, ptep) 0
> +
> #endif /* !CONFIG_HUGETLB_PAGE */
>
> #define HUGETLB_ANON_FILE "anon_hugepage"
> diff --git v3.11-rc3.orig/include/linux/mm_types.h v3.11-rc3/include/linux/mm_types.h
> index fb425aa..cfb8c6f 100644
> --- v3.11-rc3.orig/include/linux/mm_types.h
> +++ v3.11-rc3/include/linux/mm_types.h
> @@ -24,6 +24,8 @@
> struct address_space;
>
> #define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
> +#define USE_SPLIT_PTLOCKS_HUGETLB \
> + (USE_SPLIT_PTLOCKS && !defined(CONFIG_PPC))
>
Is that a common pattern ? Don't we generally use
HAVE_ARCH_SPLIT_PTLOCKS in arch config file ? Also are we sure this is
only an issue with PPC ?
-aneesh
--
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:[~2013-09-08 16:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-05 21:27 [PATCH 0/2 v3] split page table lock for hugepage Naoya Horiguchi
2013-09-05 21:27 ` [PATCH 1/2] hugetlbfs: support split page table lock Naoya Horiguchi
2013-09-08 16:53 ` Aneesh Kumar K.V [this message]
2013-09-09 16:26 ` Naoya Horiguchi
2013-09-05 21:27 ` [PATCH 2/2] thp: " Naoya Horiguchi
2013-09-06 10:48 ` Kirill A. Shutemov
2013-09-06 16:27 ` Naoya Horiguchi
2013-09-06 16:46 ` Kirill A. Shutemov
2013-09-06 17:15 ` Naoya Horiguchi
2013-09-08 16:56 ` Aneesh Kumar K.V
2013-09-06 16:04 ` Alex Thorlton
2013-09-06 18:01 ` Naoya Horiguchi
-- strict thread matches above, loose matches on Subject: below --
2013-08-30 17:18 [PATCH 0/2 v2] split page table lock for hugepage Naoya Horiguchi
2013-08-30 17:18 ` [PATCH 1/2] hugetlbfs: support split page table lock Naoya Horiguchi
2013-09-04 7:13 ` Aneesh Kumar K.V
2013-09-04 16:32 ` Naoya Horiguchi
2013-09-05 9:18 ` Aneesh Kumar K.V
2013-09-05 15:23 ` Naoya Horiguchi
2013-05-28 19:52 [PATCH 0/2] " Naoya Horiguchi
2013-05-28 19:52 ` [PATCH 1/2] " Naoya Horiguchi
2013-05-29 1:09 ` Wanpeng Li
2013-05-29 1:09 ` Wanpeng Li
2013-06-03 13:19 ` Michal Hocko
2013-06-03 14:34 ` Naoya Horiguchi
2013-06-03 15:42 ` Michal Hocko
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=871u4zi7a4.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=athorlton@sgi.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kosaki.motohiro@jp.fujitsu.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 \
/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).