Re: [PATCHv6 26/36] mm: rework mapcount accounting to enable 4k mapping of THPs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 10, 2015 at 03:47:06PM +0200, Vlastimil Babka wrote:
> On 06/03/2015 07:05 PM, Kirill A. Shutemov wrote:
> >@@ -415,8 +428,17 @@ static inline void page_mapcount_reset(struct page *page)
> >
> >  static inline int page_mapcount(struct page *page)
> >  {
> >+	int ret;
> >  	VM_BUG_ON_PAGE(PageSlab(page), page);
> >-	return atomic_read(&page->_mapcount) + 1;
> >+
> >+	ret = atomic_read(&page->_mapcount) + 1;
> >+	if (PageCompound(page)) {
> >+		page = compound_head(page);
> >+		ret += compound_mapcount(page);
> 
> compound_mapcount() means another PageCompound() and compound_head(), which
> you just did. I've tried this to see the effect on a function that "calls"
> (inlines) page_mapcount() once:
> 
> -               ret += compound_mapcount(page);
> +               ret += atomic_read(compound_mapcount_ptr(page)) + 1;
> 
> bloat-o-meter on compaction.o:
> add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-59 (-59)
> function                                     old     new   delta
> isolate_migratepages_block                  1769    1710     -59

Okay, fair enough.

> >diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> >index 74b7cece1dfa..a8d47c1edf6a 100644
> >--- a/include/linux/page-flags.h
> >+++ b/include/linux/page-flags.h
> >@@ -127,6 +127,9 @@ enum pageflags {
> >
> >  	/* SLOB */
> >  	PG_slob_free = PG_private,
> >+
> >+	/* THP. Stored in first tail page's flags */
> >+	PG_double_map = PG_private_2,
> 
> Well, not just THP. Any user of compound pages must make sure not to use
> PG_private_2 on the first tail page. At least where the page is going to be
> user-mapped. And same thing about fields that are in union with
> compound_mapcount. Should that be documented more prominently somewhere?

I would substitute "THP" for "Compound pages".

> I guess there's no such user so far, right?

I believe so.

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]