lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 20 May 2015 17:38:43 +0300
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Vlastimil Babka <vbabka@...e.cz>
Cc:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Hansen <dave.hansen@...el.com>,
	Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
	Christoph Lameter <cl@...two.org>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Steve Capper <steve.capper@...aro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>,
	Jerome Marchand <jmarchan@...hat.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv5 22/28] thp: implement split_huge_pmd()

On Tue, May 19, 2015 at 10:25:30AM +0200, Vlastimil Babka wrote:
> On 04/23/2015 11:03 PM, Kirill A. Shutemov wrote:
> >Original split_huge_page() combined two operations: splitting PMDs into
> >tables of PTEs and splitting underlying compound page. This patch
> >implements split_huge_pmd() which split given PMD without splitting
> >other PMDs this page mapped with or underlying compound page.
> >
> >Without tail page refcounting, implementation of split_huge_pmd() is
> >pretty straight-forward.
> >
> >Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> >Tested-by: Sasha Levin <sasha.levin@...cle.com>
> >---
> >  include/linux/huge_mm.h |  11 ++++-
> >  mm/huge_memory.c        | 108 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 118 insertions(+), 1 deletion(-)
> >
> >diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> >index 0382230b490f..b7844c73b7db 100644
> >--- a/include/linux/huge_mm.h
> >+++ b/include/linux/huge_mm.h
> >@@ -94,7 +94,16 @@ extern unsigned long transparent_hugepage_flags;
> >
> >  #define split_huge_page_to_list(page, list) BUILD_BUG()
> >  #define split_huge_page(page) BUILD_BUG()
> >-#define split_huge_pmd(__vma, __pmd, __address) BUILD_BUG()
> >+
> >+void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
> >+		unsigned long address);
> >+
> >+#define split_huge_pmd(__vma, __pmd, __address)				\
> >+	do {								\
> >+		pmd_t *____pmd = (__pmd);				\
> >+		if (unlikely(pmd_trans_huge(*____pmd)))			\
> 
> Given that most of calls to split_huge_pmd() appear to be in
> if (pmd_trans_huge(...)) branches, this unlikely() seems counter-productive.

Fair enough.

> >+void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
> >+		unsigned long address)
> >+{
> >+	spinlock_t *ptl;
> >+	struct mm_struct *mm = vma->vm_mm;
> >+	unsigned long haddr = address & HPAGE_PMD_MASK;
> >+
> >+	mmu_notifier_invalidate_range_start(mm, haddr, haddr + HPAGE_PMD_SIZE);
> >+	ptl = pmd_lock(mm, pmd);
> >+	if (likely(pmd_trans_huge(*pmd)))
> 
> This likely is likely useless :)
 
No, it's not. We check the pmd with pmd_trans_huge() under ptl for the
first time. And __split_huge_pmd_locked() assumes pmd is huge.

> >+		__split_huge_pmd_locked(vma, pmd, haddr);
> >+	spin_unlock(ptl);
> >+	mmu_notifier_invalidate_range_end(mm, haddr, haddr + HPAGE_PMD_SIZE);
> >+}
> >+
-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ