From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: netdev@vger.kernel.org, linux-mm@kvack.org
Cc: David Miller <davem@davemloft.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [RFC][PATCH 2/6] mm: allow PF_MEMALLOC from softirq context
Date: Thu, 30 Nov 2006 11:14:53 +0100 [thread overview]
Message-ID: <20061130101921.360226000@chello.nl> (raw)
In-Reply-To: 20061130101451.495412000@chello.nl
[-- Attachment #1: page-alloc-softirq.patch --]
[-- Type: text/plain, Size: 2343 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-11-29 16:23:02.000000000 +0100
+++ linux-2.6-git/mm/internal.h 2006-11-29 16:34:17.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-11-29 16:15:54.000000000 +0100
+++ linux-2.6-git/kernel/softirq.c 2006-11-29 16:32:47.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:[~2006-11-30 10:14 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 10:14 [RFC][PATCH 0/6] VM deadlock avoidance -v9 Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 1/6] mm: slab allocation fairness Peter Zijlstra
2006-11-30 18:52 ` Christoph Lameter
2006-11-30 18:52 ` Christoph Lameter
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 19:33 ` Christoph Lameter
2006-11-30 19:33 ` Christoph Lameter
2006-11-30 19:33 ` Peter Zijlstra
2006-11-30 19:33 ` Peter Zijlstra
2006-12-01 11:28 ` Peter Zijlstra
2006-12-01 11:28 ` Peter Zijlstra
2006-11-30 19:02 ` Peter Zijlstra
2006-11-30 19:02 ` Peter Zijlstra
2006-11-30 19:37 ` Christoph Lameter
2006-11-30 19:37 ` Christoph Lameter
2006-11-30 19:40 ` Peter Zijlstra
2006-11-30 19:40 ` Peter Zijlstra
2006-11-30 20:11 ` Christoph Lameter
2006-11-30 20:11 ` Christoph Lameter
2006-11-30 20:15 ` Peter Zijlstra
2006-11-30 20:15 ` Peter Zijlstra
2006-11-30 20:29 ` Christoph Lameter
2006-11-30 20:29 ` Christoph Lameter
2006-11-30 10:14 ` Peter Zijlstra [this message]
2006-11-30 10:14 ` [RFC][PATCH 3/6] mm: serialize access to min_free_kbytes Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 4/6] mm: emergency pool and __GFP_EMERGENCY Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 5/6] slab: kmem_cache_objs_to_pages() Peter Zijlstra
2006-11-30 18:55 ` Christoph Lameter
2006-11-30 18:55 ` Christoph Lameter
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 19:06 ` Christoph Lameter
2006-11-30 19:06 ` Christoph Lameter
2006-11-30 19:03 ` Peter Zijlstra
2006-11-30 19:03 ` Peter Zijlstra
2006-12-01 12:14 ` Peter Zijlstra
2006-12-01 12:14 ` Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 6/6] net: vm deadlock avoidance core Peter Zijlstra
2006-11-30 12:04 ` Peter Zijlstra
2006-11-30 12:04 ` 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=20061130101921.360226000@chello.nl \
--to=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.