lkml.org 
[lkml]   [2005]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] vm - swap_prefetch-15
On Fri, 7 Oct 2005, Con Kolivas wrote:
> That will end up being far more intrusive than this version and __alloc_pages
> would need more tests that affect every call to __alloc_pages which seems
> much more expensive to me than exporting buffered_rmqueue and
> zone_statistics, and the modified __alloc_pages will still be a much more
> complicated function than prefetch_get_page.

Short-term, perhaps. However, what you are doing is inventing your own
page allocator which, I suspect, is more expensive in the long term.

Up to you of course and I am probably the wrong person to talk to about
this. Never the less, here's a totally untested patch to do it.

Pekka

Index: 2.6/include/linux/gfp.h
===================================================================
--- 2.6.orig/include/linux/gfp.h
+++ 2.6/include/linux/gfp.h
@@ -41,6 +41,7 @@ struct vm_area_struct;
#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
#define __GFP_HARDWALL 0x40000u /* Enforce hardwall cpuset memory allocs */
+#define __GFP_NEVER_RECLAIM 0x80000u /* Never attempt to reclaim */

#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
Index: 2.6/mm/page_alloc.c
===================================================================
--- 2.6.orig/mm/page_alloc.c
+++ 2.6/mm/page_alloc.c
@@ -778,6 +778,7 @@ __alloc_pages(unsigned int __nocast gfp_
struct zonelist *zonelist)
{
const int wait = gfp_mask & __GFP_WAIT;
+ const int can_reclaim = !(gfp_mask & __GFP_NEVER_RECLAIM);
struct zone **zones, *z;
struct page *page;
struct reclaim_state reclaim_state;
@@ -812,7 +813,7 @@ restart:
* See also cpuset_zone_allowed() comment in kernel/cpuset.c.
*/
for (i = 0; (z = zones[i]) != NULL; i++) {
- int do_reclaim = should_reclaim_zone(z, gfp_mask);
+ int do_reclaim = can_reclaim && should_reclaim_zone(z, gfp_mask);

if (!cpuset_zone_allowed(z, __GFP_HARDWALL))
continue;
@@ -840,6 +841,9 @@ zone_reclaim_retry:
goto got_pg;
}

+ if (unlikely(!can_reclaim))
+ goto out;
+
for (i = 0; (z = zones[i]) != NULL; i++)
wakeup_kswapd(z, order);

@@ -966,6 +970,7 @@ nopage:
dump_stack();
show_mem();
}
+out:
return NULL;
got_pg:
zone_statistics(zonelist, z);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-10-07 14:52    [W:0.036 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site