From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org
Cc: David Miller <davem@davemloft.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 3/9] mm: allow PF_MEMALLOC from softirq context
Date: Tue, 16 Jan 2007 10:46:00 +0100 [thread overview]
Message-ID: <20070116101815.426856000@taijtu.programming.kicks-ass.net> (raw)
In-Reply-To: <20070116094557.494892000@taijtu.programming.kicks-ass.net>
[-- Attachment #1: PF_MEMALLOC-softirq.patch --]
[-- Type: text/plain, Size: 2344 bytes --]
Allow PF_MEMALLOC to be set in softirq context. When running softirqs from
a borrowed context save current->flags, ksoftirqd will have its own
task_struct.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/softirq.c | 3 +++
mm/internal.h | 14 ++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
Index: linux-2.6-git/mm/internal.h
===================================================================
--- linux-2.6-git.orig/mm/internal.h 2006-12-14 10:02:52.000000000 +0100
+++ linux-2.6-git/mm/internal.h 2006-12-14 10:10:09.000000000 +0100
@@ -75,9 +75,10 @@ static int inline gfp_to_alloc_flags(gfp
alloc_flags |= ALLOC_HARDER;
if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) {
- if (!in_interrupt() &&
- ((p->flags & PF_MEMALLOC) ||
- unlikely(test_thread_flag(TIF_MEMDIE))))
+ if (!in_irq() && (p->flags & PF_MEMALLOC))
+ alloc_flags |= ALLOC_NO_WATERMARKS;
+ else if (!in_interrupt() &&
+ unlikely(test_thread_flag(TIF_MEMDIE)))
alloc_flags |= ALLOC_NO_WATERMARKS;
}
@@ -117,9 +118,10 @@ static inline int gfp_to_rank(gfp_t gfp_
*/
if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) {
- if (!in_interrupt() &&
- ((current->flags & PF_MEMALLOC) ||
- unlikely(test_thread_flag(TIF_MEMDIE))))
+ if (!in_irq() && (current->flags & PF_MEMALLOC))
+ return 0;
+ else if (!in_interrupt() &&
+ unlikely(test_thread_flag(TIF_MEMDIE)))
return 0;
}
Index: linux-2.6-git/kernel/softirq.c
===================================================================
--- linux-2.6-git.orig/kernel/softirq.c 2006-12-14 10:02:18.000000000 +0100
+++ linux-2.6-git/kernel/softirq.c 2006-12-14 10:02:52.000000000 +0100
@@ -209,6 +209,8 @@ asmlinkage void __do_softirq(void)
__u32 pending;
int max_restart = MAX_SOFTIRQ_RESTART;
int cpu;
+ unsigned long pflags = current->flags;
+ current->flags &= ~PF_MEMALLOC;
pending = local_softirq_pending();
account_system_vtime(current);
@@ -247,6 +249,7 @@ restart:
account_system_vtime(current);
_local_bh_enable();
+ current->flags = pflags;
}
#ifndef __ARCH_HAS_DO_SOFTIRQ
--
--
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>
next prev parent reply other threads:[~2007-01-16 9:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-16 9:45 [PATCH 0/9] VM deadlock avoidance -v10 Peter Zijlstra
2007-01-16 9:45 ` [PATCH 1/9] mm: page allocation rank Peter Zijlstra
2007-01-16 9:45 ` [PATCH 2/9] mm: slab allocation fairness Peter Zijlstra
2007-01-16 9:46 ` Peter Zijlstra [this message]
2007-01-16 9:46 ` [PATCH 4/9] mm: serialize access to min_free_kbytes Peter Zijlstra
2007-01-16 9:46 ` [PATCH 5/9] mm: emergency pool Peter Zijlstra
2007-01-16 9:46 ` [PATCH 6/9] mm: __GFP_EMERGENCY Peter Zijlstra
2007-01-16 9:46 ` [PATCH 7/9] mm: allow mempool to fall back to memalloc reserves Peter Zijlstra
2007-01-16 9:46 ` [PATCH 8/9] slab: kmem_cache_objs_to_pages() Peter Zijlstra
2007-01-16 9:46 ` [PATCH 9/9] net: vm deadlock avoidance core Peter Zijlstra
2007-01-16 13:25 ` Evgeniy Polyakov
2007-01-16 13:47 ` Peter Zijlstra
2007-01-16 15:33 ` Evgeniy Polyakov
2007-01-16 16:08 ` Peter Zijlstra
2007-01-17 4:54 ` Evgeniy Polyakov
2007-01-17 9:07 ` Peter Zijlstra
2007-01-18 10:41 ` Evgeniy Polyakov
2007-01-18 12:18 ` Peter Zijlstra
2007-01-18 13:58 ` Possible ways of dealing with OOM conditions Evgeniy Polyakov
2007-01-18 15:10 ` Peter Zijlstra
2007-01-18 15:50 ` Evgeniy Polyakov
2007-01-18 17:31 ` Peter Zijlstra
2007-01-18 18:34 ` Evgeniy Polyakov
2007-01-19 12:53 ` Peter Zijlstra
2007-01-19 22:56 ` Evgeniy Polyakov
2007-01-20 22:36 ` Rik van Riel
2007-01-21 1:46 ` Evgeniy Polyakov
2007-01-21 2:14 ` Evgeniy Polyakov
2007-01-21 16:30 ` Rik van Riel
2007-01-19 17:54 ` Christoph Lameter
2007-01-17 9:12 ` [PATCH 0/9] VM deadlock avoidance -v10 Pavel Machek
2007-01-17 9:20 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070116101815.426856000@taijtu.programming.kicks-ass.net \
--to=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox