Re: [RFC] Making compound pages mandatory

From: Nick Piggin
Date: Tue Nov 16 2004 - 22:14:49 EST


Andrew Morton wrote:
Linus Torvalds <torvalds@xxxxxxxx> wrote:



On Tue, 16 Nov 2004, David Howells wrote:

Do you have any objection to compound pages being made mandatory, even without
HUGETLB support?

I haven't really looked into it, so I cannot make an informed decision. How big is the overhead? And what's the _point_, since we don't seem to need them normally, but the code is there for people who _do_ need them?


Yes, it's just the single pointer chase. Probably that's the common case
now, because everyone will be enabling hugepages on lots of architectures.

But still, the non-compound code is well tested too, and leaving it in
place does make a little microoptimisation available to those who want it,
so I don't see a reason yet to make compound pages compulsory.

So I'd suggest that we make compound pages conditional on a new
CONFIG_COMPOUND_PAGE and make that equal to HUGETLB_PAGE || !MMU.

Good idea. BTW, any reason why the following (very)micro optimisation
shouldn't go in?

It currently only picks up a couple of things under fs/, but might help
reduce other ifdefery around the place. For example mm.h: page_count and
get_page.



---

linux-2.6-npiggin/include/linux/page-flags.h | 4 ++++
1 files changed, 4 insertions(+)

diff -puN include/linux/page-flags.h~mm-page_compound-microopt include/linux/page-flags.h
--- linux-2.6/include/linux/page-flags.h~mm-page_compound-microopt 2004-11-17 14:02:44.000000000 +1100
+++ linux-2.6-npiggin/include/linux/page-flags.h 2004-11-17 14:09:07.000000000 +1100
@@ -286,7 +286,11 @@ extern unsigned long __read_page_state(u
#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)

+#ifdef CONFIG_HUGETLB_PAGE
#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
+#else
+#define PageCompound(page) 0
+#endif
#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags)
#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags)


_