From: Andrea Arcangeli This makes memdie a TIF_MEMDIE. memdie will not be modified by the current task, so it cannot be a PF_MEMDIE but it must be a TIF_MEMDIE. Signed-off-by: Andrea Arcangeli Signed-off-by: Andrew Morton --- 25-akpm/include/asm-alpha/thread_info.h | 1 + 25-akpm/include/asm-arm/thread_info.h | 1 + 25-akpm/include/asm-arm26/thread_info.h | 1 + 25-akpm/include/asm-cris/thread_info.h | 1 + 25-akpm/include/asm-h8300/thread_info.h | 1 + 25-akpm/include/asm-i386/thread_info.h | 1 + 25-akpm/include/asm-ia64/thread_info.h | 1 + 25-akpm/include/asm-m32r/thread_info.h | 1 + 25-akpm/include/asm-m68k/thread_info.h | 1 + 25-akpm/include/asm-m68knommu/thread_info.h | 1 + 25-akpm/include/asm-mips/thread_info.h | 1 + 25-akpm/include/asm-parisc/thread_info.h | 1 + 25-akpm/include/asm-ppc/thread_info.h | 1 + 25-akpm/include/asm-ppc64/thread_info.h | 1 + 25-akpm/include/asm-s390/thread_info.h | 1 + 25-akpm/include/asm-sh/thread_info.h | 1 + 25-akpm/include/asm-sh64/thread_info.h | 1 + 25-akpm/include/asm-sparc/thread_info.h | 1 + 25-akpm/include/asm-sparc64/thread_info.h | 1 + 25-akpm/include/asm-um/thread_info.h | 1 + 25-akpm/include/asm-v850/thread_info.h | 1 + 25-akpm/include/asm-x86_64/thread_info.h | 1 + 25-akpm/include/linux/sched.h | 5 ----- 25-akpm/mm/oom_kill.c | 5 +++-- 25-akpm/mm/page_alloc.c | 2 +- 25 files changed, 26 insertions(+), 8 deletions(-) diff -puN include/asm-alpha/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-alpha/thread_info.h --- 25/include/asm-alpha/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag 2005-01-22 23:05:39.511536536 -0800 +++ 25-akpm/include/asm-alpha/thread_info.h 2005-01-22 23:05:39.548530912 -0800 @@ -77,6 +77,7 @@ register struct thread_info *__current_t #define TIF_UAC_NOPRINT 6 /* see sysinfo.h */ #define TIF_UAC_NOFIX 7 #define TIF_UAC_SIGBUS 8 +#define TIF_MEMDIE 9 #define _TIF_SYSCALL_TRACE (1<memdie || (p->flags & PF_EXITING)) && !(p->flags & PF_DEAD)) + if ((unlikely(test_tsk_thread_flag(p, TIF_MEMDIE)) || (p->flags & PF_EXITING)) && + !(p->flags & PF_DEAD)) return ERR_PTR(-1UL); if (p->flags & PF_SWAPOFF) return p; @@ -196,7 +197,7 @@ static void __oom_kill_task(task_t *p) * exit() and clear out its resources quickly... */ p->time_slice = HZ; - p->memdie = 1; + set_tsk_thread_flag(p, TIF_MEMDIE); /* This process has hardware access, be more careful. */ if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO)) { diff -puN mm/page_alloc.c~mm-convert-memdie-to-an-atomic-thread-bitflag mm/page_alloc.c --- 25/mm/page_alloc.c~mm-convert-memdie-to-an-atomic-thread-bitflag 2005-01-22 23:05:39.544531520 -0800 +++ 25-akpm/mm/page_alloc.c 2005-01-22 23:05:39.559529240 -0800 @@ -756,7 +756,7 @@ __alloc_pages(unsigned int gfp_mask, uns } /* This allocation should allow future memory freeing. */ - if (((p->flags & PF_MEMALLOC) || p->memdie) && !in_interrupt()) { + if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE))) && !in_interrupt()) { /* go through the zonelist yet again, ignoring mins */ for (i = 0; (z = zones[i]) != NULL; i++) { page = buffered_rmqueue(z, order, gfp_mask); _