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]
Message-ID: <20150304132617.GB16452@node.dhcp.inet.fi>
Date:	Wed, 4 Mar 2015 15:26:17 +0200
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>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv3 04/24] rmap: add argument to charge compound page

On Wed, Mar 04, 2015 at 01:09:51PM +0100, Vlastimil Babka wrote:
> On 03/04/2015 12:52 PM, Kirill A. Shutemov wrote:
> >On Mon, Feb 23, 2015 at 05:21:31PM +0100, Vlastimil Babka wrote:
> >>On 02/12/2015 05:18 PM, Kirill A. Shutemov wrote:
> >>>@@ -1052,21 +1052,24 @@ void page_add_anon_rmap(struct page *page,
> >>>   * Everybody else should continue to use page_add_anon_rmap above.
> >>>   */
> >>>  void do_page_add_anon_rmap(struct page *page,
> >>>-	struct vm_area_struct *vma, unsigned long address, int exclusive)
> >>>+	struct vm_area_struct *vma, unsigned long address, int flags)
> >>>  {
> >>>  	int first = atomic_inc_and_test(&page->_mapcount);
> >>>  	if (first) {
> >>>+		bool compound = flags & RMAP_COMPOUND;
> >>>+		int nr = compound ? hpage_nr_pages(page) : 1;
> >>
> >>hpage_nr_pages(page) is:
> >>
> >>static inline int hpage_nr_pages(struct page *page)
> >>{
> >>         if (unlikely(PageTransHuge(page)))
> >>                 return HPAGE_PMD_NR;
> >>         return 1;
> >>}
> >>
> >>and later...
> >>
> >>>  		/*
> >>>  		 * We use the irq-unsafe __{inc|mod}_zone_page_stat because
> >>>  		 * these counters are not modified in interrupt context, and
> >>>  		 * pte lock(a spinlock) is held, which implies preemption
> >>>  		 * disabled.
> >>>  		 */
> >>>-		if (PageTransHuge(page))
> >>>+		if (compound) {
> >>>+			VM_BUG_ON_PAGE(!PageTransHuge(page), page);
> >>
> >>this means that we could assume that
> >>(compound == true) => (PageTransHuge(page) == true)
> >>
> >>and simplify above to:
> >>
> >>int nr = compound ? HPAGE_PMD_NR : 1;
> >>
> >>Right?
> >
> >No. HPAGE_PMD_NR is defined based on HPAGE_PMD_SHIFT which is BUILD_BUG()
> >without CONFIG_TRANSPARENT_HUGEPAGE. We will get compiler error without
> >the helper.
> 
> Oh, OK. But that doesn't mean there couldn't be another helper that would
> work in this case, or even open-coded #ifdefs in these functions. Apparently
> "compound" has to be always false for !CONFIG_TRANSPARENT_HUGEPAGE, as in
> that case PageTransHuge is defined as 0 and the VM_BUG_ON would trigger if
> compound was true. So without such ifdefs or wrappers, you are also adding
> dead code and pointless tests for !CONFIG_TRANSPARENT_HUGEPAGE?

Yeah, this definitely can be improved. I prefer to do it as follow up.
I want to get stable what I have now.

-- 
 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