PF_MEM_NOWAIT - will make allocations fail before blocking. This is usefull to convert process behaviour to non-blocking. Signed-off-by: Peter Zijlstra CC: Mike Christie --- include/linux/sched.h | 1 + mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6/include/linux/sched.h =================================================================== --- linux-2.6.orig/include/linux/sched.h +++ linux-2.6/include/linux/sched.h @@ -1056,6 +1056,7 @@ static inline void put_task_struct(struc #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ +#define PF_MEM_NOWAIT 0x40000000 /* Make allocations fail instead of block */ /* * Only the _current_ task can read/write to tsk->flags, but other Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c +++ linux-2.6/mm/page_alloc.c @@ -912,11 +912,11 @@ struct page * fastcall __alloc_pages(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist) { - const gfp_t wait = gfp_mask & __GFP_WAIT; + struct task_struct *p = current; + const int wait = (gfp_mask & __GFP_WAIT) && !(p->flags & PF_MEM_NOWAIT); struct zone **z; struct page *page; struct reclaim_state reclaim_state; - struct task_struct *p = current; int do_retry; int alloc_flags; int did_some_progress; -- - 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/