* [patch 0/6] Compound Page Enhancements
@ 2007-05-25 5:17 clameter
2007-05-25 5:17 ` [patch 1/6] Compound page handling enhancements clameter
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
This patch enhances the handling of compound pages in the VM. It may also
be important also for the antifrag patches that need to manage a set of
higher order free pages and also for other uses of compound pages.
For now it simplifies accounting for SLUB pages but the groundwork here is
important for the large block size patches and for allowing to page migration
of larger pages. With this framework we may be able to get to a point where
compound pages keep their flags while they are free and Mel may avoid having
special functions for determining the page order of higher order freed pages.
If we can avoid the setup and teardown of higher order pages then allocation
and release of compound pages will be faster.
Looking at the handling of compound pages we see that the fact that a page
is part of a higher order page is not that interesting. The differentiation
is mainly for head pages and tail pages of higher order pages. Head pages
usually need special handling to accomodate the larger size. It is usually
an error if tail pages are encountered. Or else they need to be treated
like PAGE_SIZE pages. So a compound flag in the page flags is not what we
need. Instead we introduce a flag for the head page and another for the tail
page. The PageCompound test is preserved for backward compatibility and
will test if either PageTail or PageHead has been set.
After this patchset the uses of CompoundPage() will be reduced significantly
in the core VM. The I/O layer will still use CompoundPage() for direct I/O.
However, if we at some point convert direct I/O to also support compound
pages as a single unit then CompoundPage() there may become unecessary as
well as the leftover check in mm/swap.c. We may end up mostly with checks
for PageTail and PageHead.
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 1/6] Compound page handling enhancements
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 5:17 ` [patch 2/6] compound pages: Add new support functions clameter
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_headtail --]
[-- Type: text/plain, Size: 6597 bytes --]
This patch enhances the handling of compound pages in the VM. It may also
be important also for the antifrag patches that need to manage a set of
higher order free pages and also for other uses of compound pages.
For now it simplifies accounting for SLUB pages but the groundwork here is
important for the large block size patches and for allowing to page migration
of larger pages. With this framework we may be able to get to a point where
compound pages keep their flags while they are free and Mel may avoid having
special functions for determining the page order of higher order freed pages.
If we can avoid the setup and teardown of higher order pages then allocation
and release of compound pages will be faster.
Looking at the handling of compound pages we see that the fact that a page
is part of a higher order page is not that interesting. The differentiation
is mainly for head pages and tail pages of higher order pages. Head pages
usually need special handling to accomodate the larger size. It is usually
an error if tail pages are encountered. Or else they need to be treated
like PAGE_SIZE pages. So a compound flag in the page flags is not what we
need. Instead we introduce a flag for the head page and another for the tail
page. The PageCompound test is preserved for backward compatibility and
will test if either PageTail or PageHead has been set.
After this patchset the uses of CompoundPage() will be reduced significantly
in the core VM. The I/O layer will still use CompoundPage() for direct I/O.
However, if we at some point convert direct I/O to also support compound
pages as a single unit then CompoundPage() there may become unecessary as
well as the leftover check in mm/swap.c. We may end up mostly with checks
for PageTail and PageHead.
This patch:
Use two separate page flags for the head and tail of compound pages.
PageHead() and PageTail() become more efficient.
PageCompound then becomes a check for PageTail || PageHead. Over time
it is expected that PageCompound will mostly go away since the head page
processing will be different from tail page processing is most situations.
We can remove the compound page check from set_page_refcounted since
PG_reclaim is no longer overloaded.
Also the check in _free_one_page can only be for PageHead. We cannot
free a tail page.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/page-flags.h | 43 ++++++++++++-------------------------------
mm/internal.h | 2 +-
mm/page_alloc.c | 2 +-
3 files changed, 14 insertions(+), 33 deletions(-)
Index: slub/include/linux/page-flags.h
===================================================================
--- slub.orig/include/linux/page-flags.h 2007-05-24 20:54:17.000000000 -0700
+++ slub/include/linux/page-flags.h 2007-05-24 21:12:21.000000000 -0700
@@ -83,7 +83,6 @@
#define PG_private 11 /* If pagecache, has fs-private data */
#define PG_writeback 12 /* Page is under writeback */
-#define PG_compound 13 /* Part of a compound page */
#define PG_swapcache 14 /* Swap page: swp_entry_t in private */
#define PG_mappedtodisk 15 /* Has blocks allocated on-disk */
@@ -92,6 +91,9 @@
#define PG_lazyfree 18 /* MADV_FREE potential throwaway */
#define PG_booked 19 /* Has blocks reserved on-disk */
+#define PG_head 21 /* Page is head of a compound page */
+#define PG_tail 22 /* Page is tail of a compound page */
+
/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
@@ -227,37 +229,16 @@ static inline void SetPageUptodate(struc
#define ClearPageLazyFree(page) clear_bit(PG_lazyfree, &(page)->flags)
#define __ClearPageLazyFree(page) __clear_bit(PG_lazyfree, &(page)->flags)
-#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
-#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags)
-#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags)
-
-/*
- * PG_reclaim is used in combination with PG_compound to mark the
- * head and tail of a compound page
- *
- * PG_compound & PG_reclaim => Tail page
- * PG_compound & ~PG_reclaim => Head page
- */
-
-#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
-
-#define PageTail(page) ((page->flags & PG_head_tail_mask) \
- == PG_head_tail_mask)
-
-static inline void __SetPageTail(struct page *page)
-{
- page->flags |= PG_head_tail_mask;
-}
-
-static inline void __ClearPageTail(struct page *page)
-{
- page->flags &= ~PG_head_tail_mask;
-}
+#define PageHead(page) test_bit(PG_head, &(page)->flags)
+#define __SetPageHead(page) __set_bit(PG_head, &(page)->flags)
+#define __ClearPageHead(page) __clear_bit(PG_head, &(page)->flags)
+
+#define PageTail(page) test_bit(PG_tail, &(page->flags))
+#define __SetPageTail(page) __set_bit(PG_tail, &(page)->flags)
+#define __ClearPageTail(page) __clear_bit(PG_tail, &(page)->flags)
-#define PageHead(page) ((page->flags & PG_head_tail_mask) \
- == (1L << PG_compound))
-#define __SetPageHead(page) __SetPageCompound(page)
-#define __ClearPageHead(page) __ClearPageCompound(page)
+#define PageCompound(page) ((page)->flags & \
+ ((1L << PG_head) | (1L << PG_tail)))
#ifdef CONFIG_SWAP
#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
Index: slub/mm/internal.h
===================================================================
--- slub.orig/mm/internal.h 2007-05-24 21:14:35.000000000 -0700
+++ slub/mm/internal.h 2007-05-24 21:16:14.000000000 -0700
@@ -24,7 +24,7 @@ static inline void set_page_count(struct
*/
static inline void set_page_refcounted(struct page *page)
{
- VM_BUG_ON(PageCompound(page) && PageTail(page));
+ VM_BUG_ON(PageTail(page));
VM_BUG_ON(atomic_read(&page->_count));
set_page_count(page, 1);
}
Index: slub/mm/page_alloc.c
===================================================================
--- slub.orig/mm/page_alloc.c 2007-05-24 21:32:12.000000000 -0700
+++ slub/mm/page_alloc.c 2007-05-24 21:32:17.000000000 -0700
@@ -449,7 +449,7 @@ static inline void __free_one_page(struc
int order_size = 1 << order;
int migratetype = get_pageblock_migratetype(page);
- if (unlikely(PageCompound(page)))
+ if (unlikely(PageHead(page)))
destroy_compound_page(page, order);
page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1);
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 2/6] compound pages: Add new support functions
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
2007-05-25 5:17 ` [patch 1/6] Compound page handling enhancements clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 5:17 ` [patch 3/6] compound pages: vmstat support clameter
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_functions --]
[-- Type: text/plain, Size: 1344 bytes --]
compound_pages(page) -> Determines base pages of a compound page
compound_shift(page) -> Determine the page shift of a compound page
compound_size(page) -> Determine the size of a compound page
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/mm.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Index: slub/include/linux/mm.h
===================================================================
--- slub.orig/include/linux/mm.h 2007-05-24 20:43:46.000000000 -0700
+++ slub/include/linux/mm.h 2007-05-24 20:50:51.000000000 -0700
@@ -366,6 +366,21 @@ static inline void set_compound_order(st
page[1].lru.prev = (void *)order;
}
+static inline int compound_pages(struct page *page)
+{
+ return 1 << compound_order(page);
+}
+
+static inline int compound_shift(struct page *page)
+{
+ return PAGE_SHIFT + compound_order(page);
+}
+
+static inline int compound_size(struct page *page)
+{
+ return PAGE_SIZE << compound_order(page);
+}
+
/*
* Multiple processes may "see" the same page. E.g. for untouched
* mappings of /dev/null, all processes see the same page full of
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 3/6] compound pages: vmstat support
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
2007-05-25 5:17 ` [patch 1/6] Compound page handling enhancements clameter
2007-05-25 5:17 ` [patch 2/6] compound pages: Add new support functions clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 5:17 ` [patch 4/6] compound pages: Use new compound vmstat functions in SLUB clameter
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_vmstat --]
[-- Type: text/plain, Size: 2842 bytes --]
Add support for compound pages so that
inc_xxxx and dec_xxx
will increment the ZVCs by the number of pages of the compound page.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/vmstat.h | 5 ++---
mm/vmstat.c | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 8 deletions(-)
Index: slub/include/linux/vmstat.h
===================================================================
--- slub.orig/include/linux/vmstat.h 2007-05-24 20:37:44.000000000 -0700
+++ slub/include/linux/vmstat.h 2007-05-24 21:00:06.000000000 -0700
@@ -234,7 +234,7 @@ static inline void __inc_zone_state(stru
static inline void __inc_zone_page_state(struct page *page,
enum zone_stat_item item)
{
- __inc_zone_state(page_zone(page), item);
+ __mod_zone_page_state(page_zone(page), item, compound_pages(page));
}
static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
@@ -246,8 +246,7 @@ static inline void __dec_zone_state(stru
static inline void __dec_zone_page_state(struct page *page,
enum zone_stat_item item)
{
- atomic_long_dec(&page_zone(page)->vm_stat[item]);
- atomic_long_dec(&vm_stat[item]);
+ __mod_zone_page_state(page_zone(page), item, -compound_pages(page));
}
/*
Index: slub/mm/vmstat.c
===================================================================
--- slub.orig/mm/vmstat.c 2007-05-24 20:37:44.000000000 -0700
+++ slub/mm/vmstat.c 2007-05-24 21:00:06.000000000 -0700
@@ -224,7 +224,12 @@ void __inc_zone_state(struct zone *zone,
void __inc_zone_page_state(struct page *page, enum zone_stat_item item)
{
- __inc_zone_state(page_zone(page), item);
+ struct zone *z = page_zone(page);
+
+ if (likely(!PageHead(page)))
+ __inc_zone_state(z, item);
+ else
+ __mod_zone_page_state(z, item, compound_pages(page));
}
EXPORT_SYMBOL(__inc_zone_page_state);
@@ -245,7 +250,12 @@ void __dec_zone_state(struct zone *zone,
void __dec_zone_page_state(struct page *page, enum zone_stat_item item)
{
- __dec_zone_state(page_zone(page), item);
+ struct zone *z = page_zone(page);
+
+ if (likely(!PageHead(page)))
+ __dec_zone_state(z, item);
+ else
+ __mod_zone_page_state(z, item, -compound_pages(page));
}
EXPORT_SYMBOL(__dec_zone_page_state);
@@ -261,11 +271,9 @@ void inc_zone_state(struct zone *zone, e
void inc_zone_page_state(struct page *page, enum zone_stat_item item)
{
unsigned long flags;
- struct zone *zone;
- zone = page_zone(page);
local_irq_save(flags);
- __inc_zone_state(zone, item);
+ __inc_zone_page_state(page, item);
local_irq_restore(flags);
}
EXPORT_SYMBOL(inc_zone_page_state);
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 4/6] compound pages: Use new compound vmstat functions in SLUB
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
` (2 preceding siblings ...)
2007-05-25 5:17 ` [patch 3/6] compound pages: vmstat support clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 5:17 ` [patch 5/6] compound pages: Allow use of get_page_unless_zero with compound pages clameter
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_vmstat_slub --]
[-- Type: text/plain, Size: 1765 bytes --]
Use the new dec/inc functions to simplify SLUB's accounting
of pages.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/slub.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
Index: slub/mm/slub.c
===================================================================
--- slub.orig/mm/slub.c 2007-05-24 20:54:31.000000000 -0700
+++ slub/mm/slub.c 2007-05-24 21:03:45.000000000 -0700
@@ -965,7 +965,6 @@ static inline void kmem_cache_open_debug
static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
{
struct page * page;
- int pages = 1 << s->order;
if (s->order)
flags |= __GFP_COMP;
@@ -984,10 +983,9 @@ static struct page *allocate_slab(struct
if (!page)
return NULL;
- mod_zone_page_state(page_zone(page),
+ inc_zone_page_state(page,
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
- NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
- pages);
+ NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE);
return page;
}
@@ -1054,8 +1052,6 @@ out:
static void __free_slab(struct kmem_cache *s, struct page *page)
{
- int pages = 1 << s->order;
-
if (unlikely(SlabDebug(page))) {
void *p;
@@ -1064,10 +1060,9 @@ static void __free_slab(struct kmem_cach
check_object(s, page, p, 0);
}
- mod_zone_page_state(page_zone(page),
+ dec_zone_page_state(page,
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
- NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
- - pages);
+ NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE);
page->mapping = NULL;
__free_pages(page, s->order);
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 5/6] compound pages: Allow use of get_page_unless_zero with compound pages
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
` (3 preceding siblings ...)
2007-05-25 5:17 ` [patch 4/6] compound pages: Use new compound vmstat functions in SLUB clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 5:17 ` [patch 6/6] compound pages: Allow freeing of compound pages via pagevec clameter
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_get_one_unless --]
[-- Type: text/plain, Size: 1154 bytes --]
This will be needed by targeted slab reclaim in order to ensure that a
compound page allocated by SLUB will not go away under us.
It also may be needed if Mel starts to implement defragmentation. The
moving of compound pages may require the establishment of a reference
before the use of page migration functions.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/mm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: slub/include/linux/mm.h
===================================================================
--- slub.orig/include/linux/mm.h 2007-05-24 21:16:14.000000000 -0700
+++ slub/include/linux/mm.h 2007-05-24 21:16:45.000000000 -0700
@@ -293,7 +293,7 @@ static inline int put_page_testzero(stru
*/
static inline int get_page_unless_zero(struct page *page)
{
- VM_BUG_ON(PageCompound(page));
+ VM_BUG_ON(PageTail(page));
return atomic_inc_not_zero(&page->_count);
}
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [patch 6/6] compound pages: Allow freeing of compound pages via pagevec
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
` (4 preceding siblings ...)
2007-05-25 5:17 ` [patch 5/6] compound pages: Allow use of get_page_unless_zero with compound pages clameter
@ 2007-05-25 5:17 ` clameter
2007-05-25 6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
2007-05-25 8:05 ` KAMEZAWA Hiroyuki
7 siblings, 0 replies; 14+ messages in thread
From: clameter @ 2007-05-25 5:17 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
[-- Attachment #1: compound_free_via_pagevec --]
[-- Type: text/plain, Size: 2638 bytes --]
Allow the freeing of compound pages via pagevec.
In release_pages() we currently special case for compound pages in order to
be sure to always decrement the page count of the head page and not the
tail page. However that redirection to the head page is only necessary for
tail pages. So use PageTail instead of PageCompound. No change therefore
for the handling of tail pages.
The head page of a compound pages now represents single page large page.
We do the usual processing including checking if its on the LRU
and removing it (not useful right now but later when compound pages are
on the LRU this will work). Then we add the compound page to the pagevec.
Only head pages will end up on the pagevec not tail pages.
In __pagevec_free() we then check if we are freeing a head page and if
so call the destructor for the compound page.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/page_alloc.c | 13 +++++++++++--
mm/swap.c | 8 +++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
Index: slub/mm/page_alloc.c
===================================================================
--- slub.orig/mm/page_alloc.c 2007-05-24 21:34:23.000000000 -0700
+++ slub/mm/page_alloc.c 2007-05-24 21:43:24.000000000 -0700
@@ -1760,8 +1760,17 @@ void __pagevec_free(struct pagevec *pvec
{
int i = pagevec_count(pvec);
- while (--i >= 0)
- free_hot_cold_page(pvec->pages[i], pvec->cold);
+ while (--i >= 0) {
+ struct page *page = pvec->pages[i];
+
+ if (PageHead(page)) {
+ compound_page_dtor *dtor;
+
+ dtor = get_compound_page_dtor(page);
+ (*dtor)(page);
+ } else
+ free_hot_cold_page(page, pvec->cold);
+ }
}
fastcall void __free_pages(struct page *page, unsigned int order)
Index: slub/mm/swap.c
===================================================================
--- slub.orig/mm/swap.c 2007-05-24 21:34:23.000000000 -0700
+++ slub/mm/swap.c 2007-05-24 21:43:24.000000000 -0700
@@ -307,7 +307,13 @@ void release_pages(struct page **pages,
for (i = 0; i < nr; i++) {
struct page *page = pages[i];
- if (unlikely(PageCompound(page))) {
+ /*
+ * If we have a tail page on the LRU then we need to
+ * decrement the page count of the head page. There
+ * is no further need to do anything since tail pages
+ * cannot be on the LRU.
+ */
+ if (unlikely(PageTail(page))) {
if (zone) {
spin_unlock_irq(&zone->lru_lock);
zone = NULL;
--
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
` (5 preceding siblings ...)
2007-05-25 5:17 ` [patch 6/6] compound pages: Allow freeing of compound pages via pagevec clameter
@ 2007-05-25 6:00 ` Andrew Morton
2007-05-25 13:54 ` Christoph Lameter
2007-05-25 14:03 ` Christoph Lameter
2007-05-25 8:05 ` KAMEZAWA Hiroyuki
7 siblings, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2007-05-25 6:00 UTC (permalink / raw)
To: clameter; +Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
On Thu, 24 May 2007 22:17:16 -0700 clameter@sgi.com wrote:
> This patch enhances the handling of compound pages in the VM. It may also
> be important also for the antifrag patches that need to manage a set of
> higher order free pages and also for other uses of compound pages.
>
> For now it simplifies accounting for SLUB pages but the groundwork here is
> important for the large block size patches and for allowing to page migration
> of larger pages. With this framework we may be able to get to a point where
> compound pages keep their flags while they are free and Mel may avoid having
> special functions for determining the page order of higher order freed pages.
> If we can avoid the setup and teardown of higher order pages then allocation
> and release of compound pages will be faster.
>
> Looking at the handling of compound pages we see that the fact that a page
> is part of a higher order page is not that interesting. The differentiation
> is mainly for head pages and tail pages of higher order pages. Head pages
> usually need special handling to accomodate the larger size. It is usually
> an error if tail pages are encountered. Or else they need to be treated
> like PAGE_SIZE pages. So a compound flag in the page flags is not what we
> need. Instead we introduce a flag for the head page and another for the tail
> page. The PageCompound test is preserved for backward compatibility and
> will test if either PageTail or PageHead has been set.
>
> After this patchset the uses of CompoundPage() will be reduced significantly
> in the core VM. The I/O layer will still use CompoundPage() for direct I/O.
> However, if we at some point convert direct I/O to also support compound
> pages as a single unit then CompoundPage() there may become unecessary as
> well as the leftover check in mm/swap.c. We may end up mostly with checks
> for PageTail and PageHead.
>
Well I've read that, and I've read the patches and I still don't see what
the point in all this is.
And looking back on it, I don't see the point in that PG_head_tail_mask
hack either. We could have done
static inline int page_tail(struct page *page)
{
return PageCompound(page) && (page->first_page != page);
}
Confused. Don't know where this is all headed.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
` (6 preceding siblings ...)
2007-05-25 6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
@ 2007-05-25 8:05 ` KAMEZAWA Hiroyuki
2007-05-25 13:42 ` Christoph Lameter
7 siblings, 1 reply; 14+ messages in thread
From: KAMEZAWA Hiroyuki @ 2007-05-25 8:05 UTC (permalink / raw)
To: clameter; +Cc: akpm, linux-mm, mel, wli
On Thu, 24 May 2007 22:17:16 -0700
clameter@sgi.com wrote:
> This patch enhances the handling of compound pages in the VM. It may also
> be important also for the antifrag patches that need to manage a set of
> higher order free pages and also for other uses of compound pages.
>
> For now it simplifies accounting for SLUB pages but the groundwork here is
> important for the large block size patches and for allowing to page migration
> of larger pages. With this framework we may be able to get to a point where
> compound pages keep their flags while they are free and Mel may avoid having
> special functions for determining the page order of higher order freed pages.
> If we can avoid the setup and teardown of higher order pages then allocation
> and release of compound pages will be faster.
>
Keeping "free high order page" as "free compound page" in free_area[]-> and
avoid calling prep_compound_page() in page allocation ?
-Kame
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 8:05 ` KAMEZAWA Hiroyuki
@ 2007-05-25 13:42 ` Christoph Lameter
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Lameter @ 2007-05-25 13:42 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: akpm, linux-mm, mel, wli
On Fri, 25 May 2007, KAMEZAWA Hiroyuki wrote:
> Keeping "free high order page" as "free compound page" in free_area[]-> and
> avoid calling prep_compound_page() in page allocation ?
Right. That would be one benefit.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
@ 2007-05-25 13:54 ` Christoph Lameter
2007-05-25 14:03 ` Christoph Lameter
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Lameter @ 2007-05-25 13:54 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
On Thu, 24 May 2007, Andrew Morton wrote:
> Well I've read that, and I've read the patches and I still don't see what
> the point in all this is.
A. vmstat can handle compound pages. No need to determine the size
of a compound page to update VM statistics.
B. PageCompound is not useful in the long run. The processing of compound
pages in the VM requires the knowledge if this is a head or tail page. That a
page is part of a compound page is not that useful knowlege.
C. Provide some more support for higher order page handling issues that
Mel and I encounter.
D. Compound pages may be useful to handle higher order blocks on the
freelists if they can be handled efficiently. If we use the same
format for the freelist as for compound pages elsewhere then we will
have a common set of function to determine sizes etc etc.
E. Expands usefulness of get_page_unless_zero to compound pages. This
is necessary to allow the moving of slabs and the moving of higher
order pages for memory defragmentation.
F. Lays groundwork for large blocksize support.
> And looking back on it, I don't see the point in that PG_head_tail_mask
> hack either. We could have done
>
> static inline int page_tail(struct page *page)
> {
> return PageCompound(page) && (page->first_page != page);
> }
>
> Confused. Don't know where this is all headed.
To a better nicer looking VM.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
2007-05-25 13:54 ` Christoph Lameter
@ 2007-05-25 14:03 ` Christoph Lameter
2007-05-25 17:14 ` Andrew Morton
1 sibling, 1 reply; 14+ messages in thread
From: Christoph Lameter @ 2007-05-25 14:03 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
On Thu, 24 May 2007, Andrew Morton wrote:
> And looking back on it, I don't see the point in that PG_head_tail_mask
> hack either. We could have done
>
> static inline int page_tail(struct page *page)
> {
> return PageCompound(page) && (page->first_page != page);
> }
But then PageHead(page) wont work anymore. pagehead->first_page is in use
for some other purpose.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 14:03 ` Christoph Lameter
@ 2007-05-25 17:14 ` Andrew Morton
2007-05-25 18:56 ` Christoph Lameter
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Morton @ 2007-05-25 17:14 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
On Fri, 25 May 2007 07:03:22 -0700 (PDT) Christoph Lameter <clameter@sgi.com> wrote:
> On Thu, 24 May 2007, Andrew Morton wrote:
>
> > And looking back on it, I don't see the point in that PG_head_tail_mask
> > hack either. We could have done
> >
> > static inline int page_tail(struct page *page)
> > {
> > return PageCompound(page) && (page->first_page != page);
> > }
>
> But then PageHead(page) wont work anymore. pagehead->first_page is in use
> for some other purpose.
That's only because slub came along and screwed it all up. The compound
page management used to be consistent, and simple.
Specifically: that lockless_freelist afterthought rendered us unable to fix
this mess.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [patch 0/6] Compound Page Enhancements
2007-05-25 17:14 ` Andrew Morton
@ 2007-05-25 18:56 ` Christoph Lameter
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Lameter @ 2007-05-25 18:56 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Mel Gorman, KAMEZAWA Hiroyuki, William Lee Irwin III
On Fri, 25 May 2007, Andrew Morton wrote:
> > But then PageHead(page) wont work anymore. pagehead->first_page is in use
> > for some other purpose.
>
> That's only because slub came along and screwed it all up. The compound
> page management used to be consistent, and simple.
Yeah I tried to keep it that way. Had to mess it up with the strange bit
checks to get it in.
> Specifically: that lockless_freelist afterthought rendered us unable to fix
> this mess.
The main mess of page->private not being usable was fixed up. Now this can
be even cleaner if we had PageTail and PageHead.
--
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>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-05-25 18:56 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-25 5:17 [patch 0/6] Compound Page Enhancements clameter
2007-05-25 5:17 ` [patch 1/6] Compound page handling enhancements clameter
2007-05-25 5:17 ` [patch 2/6] compound pages: Add new support functions clameter
2007-05-25 5:17 ` [patch 3/6] compound pages: vmstat support clameter
2007-05-25 5:17 ` [patch 4/6] compound pages: Use new compound vmstat functions in SLUB clameter
2007-05-25 5:17 ` [patch 5/6] compound pages: Allow use of get_page_unless_zero with compound pages clameter
2007-05-25 5:17 ` [patch 6/6] compound pages: Allow freeing of compound pages via pagevec clameter
2007-05-25 6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
2007-05-25 13:54 ` Christoph Lameter
2007-05-25 14:03 ` Christoph Lameter
2007-05-25 17:14 ` Andrew Morton
2007-05-25 18:56 ` Christoph Lameter
2007-05-25 8:05 ` KAMEZAWA Hiroyuki
2007-05-25 13:42 ` Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox