
From: Andrea Arcangeli <andrea@suse.de>

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 <andrea@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 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<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-arm26/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-arm26/thread_info.h
--- 25/include/asm-arm26/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.513536232 -0800
+++ 25-akpm/include/asm-arm26/thread_info.h	2005-01-22 23:05:39.548530912 -0800
@@ -126,6 +126,7 @@ extern void free_thread_info(struct thre
 #define TIF_SYSCALL_TRACE	8
 #define TIF_USED_FPU		16
 #define TIF_POLLING_NRFLAG	17
+#define TIF_MEMDIE		18
 
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
diff -puN include/asm-arm/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-arm/thread_info.h
--- 25/include/asm-arm/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.514536080 -0800
+++ 25-akpm/include/asm-arm/thread_info.h	2005-01-22 23:05:39.548530912 -0800
@@ -128,6 +128,7 @@ extern void iwmmxt_task_release(struct t
 #define TIF_SYSCALL_TRACE	8
 #define TIF_POLLING_NRFLAG	16
 #define TIF_USING_IWMMXT	17
+#define TIF_MEMDIE		18
 
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
diff -puN include/asm-cris/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-cris/thread_info.h
--- 25/include/asm-cris/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.516535776 -0800
+++ 25-akpm/include/asm-cris/thread_info.h	2005-01-22 23:05:39.549530760 -0800
@@ -85,6 +85,7 @@ struct thread_info {
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_MEMDIE		17
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-h8300/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-h8300/thread_info.h
--- 25/include/asm-h8300/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.517535624 -0800
+++ 25-akpm/include/asm-h8300/thread_info.h	2005-01-22 23:05:39.549530760 -0800
@@ -93,6 +93,7 @@ static inline struct thread_info *curren
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	4	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
+#define TIF_MEMDIE		5
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-i386/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-i386/thread_info.h
--- 25/include/asm-i386/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.519535320 -0800
+++ 25-akpm/include/asm-i386/thread_info.h	2005-01-22 23:05:39.549530760 -0800
@@ -141,6 +141,7 @@ register unsigned long current_stack_poi
 #define TIF_IRET		5	/* return with iret */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_MEMDIE		17
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-ia64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-ia64/thread_info.h
--- 25/include/asm-ia64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.520535168 -0800
+++ 25-akpm/include/asm-ia64/thread_info.h	2005-01-22 23:05:39.550530608 -0800
@@ -75,6 +75,7 @@ struct thread_info {
 #define TIF_SYSCALL_AUDIT	4	/* syscall auditing active */
 #define TIF_SIGDELAYED		5	/* signal delayed from MCA/INIT/NMI/PMI context */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_MEMDIE		17
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
diff -puN include/asm-m32r/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-m32r/thread_info.h
--- 25/include/asm-m32r/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.522534864 -0800
+++ 25-akpm/include/asm-m32r/thread_info.h	2005-01-22 23:05:39.557529544 -0800
@@ -155,6 +155,7 @@ static inline unsigned int get_thread_fa
 #define TIF_IRET		5	/* return with iret */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 					/* 31..28 fault code */
+#define TIF_MEMDIE		17
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-m68knommu/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-m68knommu/thread_info.h
--- 25/include/asm-m68knommu/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.523534712 -0800
+++ 25-akpm/include/asm-m68knommu/thread_info.h	2005-01-22 23:05:39.551530456 -0800
@@ -85,6 +85,7 @@ static inline struct thread_info *curren
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	4	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
+#define TIF_MEMDIE		5
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-m68k/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-m68k/thread_info.h
--- 25/include/asm-m68k/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.524534560 -0800
+++ 25-akpm/include/asm-m68k/thread_info.h	2005-01-22 23:05:39.550530608 -0800
@@ -48,6 +48,7 @@ struct thread_info {
 #define TIF_NOTIFY_RESUME	2	/* resumption notification requested */
 #define TIF_SIGPENDING		3	/* signal pending */
 #define TIF_NEED_RESCHED	4	/* rescheduling necessary */
+#define TIF_MEMDIE		5
 
 extern int thread_flag_fixme(void);
 
diff -puN include/asm-mips/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-mips/thread_info.h
--- 25/include/asm-mips/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.526534256 -0800
+++ 25-akpm/include/asm-mips/thread_info.h	2005-01-22 23:05:39.551530456 -0800
@@ -116,6 +116,7 @@ register struct thread_info *__current_t
 #define TIF_SYSCALL_AUDIT	4	/* syscall auditing active */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_MEMDIE		18
 #define TIF_SYSCALL_TRACE	31	/* syscall trace active */
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-parisc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-parisc/thread_info.h
--- 25/include/asm-parisc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.527534104 -0800
+++ 25-akpm/include/asm-parisc/thread_info.h	2005-01-22 23:05:39.552530304 -0800
@@ -63,6 +63,7 @@ struct thread_info {
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	4	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_32BIT               5       /* 32 bit binary */
+#define TIF_MEMDIE		6
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
diff -puN include/asm-ppc64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-ppc64/thread_info.h
--- 25/include/asm-ppc64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.528533952 -0800
+++ 25-akpm/include/asm-ppc64/thread_info.h	2005-01-22 23:05:39.552530304 -0800
@@ -100,6 +100,7 @@ static inline struct thread_info *curren
 #define TIF_ABI_PENDING		7	/* 32/64 bit switch needed */
 #define TIF_SYSCALL_AUDIT	8	/* syscall auditing active */
 #define TIF_SINGLESTEP		9	/* singlestepping active */
+#define TIF_MEMDIE		10
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-ppc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-ppc/thread_info.h
--- 25/include/asm-ppc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.530533648 -0800
+++ 25-akpm/include/asm-ppc/thread_info.h	2005-01-22 23:05:39.552530304 -0800
@@ -76,6 +76,7 @@ static inline struct thread_info *curren
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	4	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
+#define TIF_MEMDIE		5
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-s390/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-s390/thread_info.h
--- 25/include/asm-s390/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.531533496 -0800
+++ 25-akpm/include/asm-s390/thread_info.h	2005-01-22 23:05:39.553530152 -0800
@@ -100,6 +100,7 @@ static inline struct thread_info *curren
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
 					   TIF_NEED_RESCHED */
 #define TIF_31BIT		18	/* 32bit process */ 
+#define TIF_MEMDIE		19
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-sh64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-sh64/thread_info.h
--- 25/include/asm-sh64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.532533344 -0800
+++ 25-akpm/include/asm-sh64/thread_info.h	2005-01-22 23:05:39.553530152 -0800
@@ -74,6 +74,7 @@ static inline struct thread_info *curren
 #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
+#define TIF_MEMDIE		4
 
 #define THREAD_SIZE	16384
 
diff -puN include/asm-sh/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-sh/thread_info.h
--- 25/include/asm-sh/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.534533040 -0800
+++ 25-akpm/include/asm-sh/thread_info.h	2005-01-22 23:05:39.553530152 -0800
@@ -83,6 +83,7 @@ static inline struct thread_info *curren
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_MEMDIE		18
 #define TIF_USERSPACE		31	/* true if FS sets userspace */
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-sparc64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-sparc64/thread_info.h
--- 25/include/asm-sparc64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.535532888 -0800
+++ 25-akpm/include/asm-sparc64/thread_info.h	2005-01-22 23:05:39.554530000 -0800
@@ -228,6 +228,7 @@ register struct thread_info *current_thr
  *       an immediate value in instructions such as andcc.
  */
 #define TIF_ABI_PENDING		12
+#define TIF_MEMDIE		13
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/asm-sparc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-sparc/thread_info.h
--- 25/include/asm-sparc/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.536532736 -0800
+++ 25-akpm/include/asm-sparc/thread_info.h	2005-01-22 23:05:39.554530000 -0800
@@ -138,6 +138,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, 
 					 * this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling
 					 * TIF_NEED_RESCHED */
+#define TIF_MEMDIE		10
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-um/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-um/thread_info.h
--- 25/include/asm-um/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.537532584 -0800
+++ 25-akpm/include/asm-um/thread_info.h	2005-01-22 23:05:39.555529848 -0800
@@ -71,6 +71,7 @@ static inline struct thread_info *curren
 					 * TIF_NEED_RESCHED 
 					 */
 #define TIF_RESTART_BLOCK 	4
+#define TIF_MEMDIE	 	5
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
diff -puN include/asm-v850/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-v850/thread_info.h
--- 25/include/asm-v850/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.539532280 -0800
+++ 25-akpm/include/asm-v850/thread_info.h	2005-01-22 23:05:39.555529848 -0800
@@ -83,6 +83,7 @@ struct thread_info {
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_POLLING_NRFLAG	4	/* true if poll_idle() is polling
 					   TIF_NEED_RESCHED */
+#define TIF_MEMDIE		5
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
diff -puN include/asm-x86_64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/asm-x86_64/thread_info.h
--- 25/include/asm-x86_64/thread_info.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.540532128 -0800
+++ 25-akpm/include/asm-x86_64/thread_info.h	2005-01-22 23:05:39.555529848 -0800
@@ -106,6 +106,7 @@ static inline struct thread_info *stack_
 #define TIF_IA32		17	/* 32bit process */ 
 #define TIF_FORK		18	/* ret_from_fork */
 #define TIF_ABI_PENDING		19
+#define TIF_MEMDIE		20
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
diff -puN include/linux/sched.h~mm-convert-memdie-to-an-atomic-thread-bitflag include/linux/sched.h
--- 25/include/linux/sched.h~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.541531976 -0800
+++ 25-akpm/include/linux/sched.h	2005-01-22 23:05:39.556529696 -0800
@@ -615,11 +615,6 @@ struct task_struct {
 	struct key *thread_keyring;	/* keyring private to this thread */
 #endif
 /*
- * All archs should support atomic ops with
- * 1 byte granularity.
- */
-	unsigned char memdie;
-/*
  * Must be changed atomically so it shouldn't be
  * be a shareable bitflag.
  */
diff -puN mm/oom_kill.c~mm-convert-memdie-to-an-atomic-thread-bitflag mm/oom_kill.c
--- 25/mm/oom_kill.c~mm-convert-memdie-to-an-atomic-thread-bitflag	2005-01-22 23:05:39.543531672 -0800
+++ 25-akpm/mm/oom_kill.c	2005-01-22 23:05:39.557529544 -0800
@@ -152,7 +152,8 @@ static struct task_struct * select_bad_p
 			 * This is in the process of releasing memory so wait it
 			 * to finish before killing some other task by mistake.
 			 */
-			if ((p->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);
_
