linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	David Miller <davem@davemloft.net>,
	Rik van Riel <riel@redhat.com>,
	Daniel Phillips <phillips@google.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Mike Christie <michaelc@cs.wisc.edu>
Subject: [PATCH 19/20] mm: a process flags to avoid blocking allocations
Date: Tue, 12 Sep 2006 17:25:49 +0200	[thread overview]
Message-ID: <20060912144905.106019000@chello.nl> (raw)
In-Reply-To: <20060912143049.278065000@chello.nl>

[-- Attachment #1: pf_mem_nowait.patch --]
[-- Type: text/plain, Size: 1816 bytes --]

PF_MEM_NOWAIT - will make allocations fail before blocking. This is usefull
to convert process behaviour to non-blocking.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Mike Christie <michaelc@cs.wisc.edu>
---
 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, 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>

  parent reply	other threads:[~2006-09-12 15:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-12 15:25 [PATCH 00/20] vm deadlock avoidance for NFS, NBD and iSCSI (take 7) Peter Zijlstra
2006-09-12 15:25 ` [PATCH 16/20] iscsi: add session context to ep_connect Peter Zijlstra
2006-09-12 15:25 ` [PATCH 08/20] nfs: enable swap on NFS Peter Zijlstra
2006-09-12 15:25 ` Peter Zijlstra [this message]
2006-09-12 15:25 ` [PATCH 20/20] iscsi: support for swapping over iSCSI Peter Zijlstra
2006-09-13 20:50   ` Mike Christie
2006-09-14  6:17     ` Peter Zijlstra
2006-09-14 19:22       ` Mike Christie
2006-09-14 20:35         ` Peter Zijlstra
2006-09-14 20:46           ` Peter Zijlstra
2006-09-14 21:09             ` Mike Christie
2006-09-14 21:28               ` Mike Christie
2006-09-14 21:00           ` Mike Christie
2006-09-14 21:03             ` Mike Christie
2006-09-14 21:18               ` Peter Zijlstra
2006-09-12 15:25 ` [PATCH 10/20] mm: block device swap notification Peter Zijlstra
2006-09-12 15:25 ` [PATCH 18/20] netlink: add SOCK_VMIO support to AF_NETLINK Peter Zijlstra
2006-09-12 15:25 ` [PATCH 02/20] net: vm deadlock avoidance core Peter Zijlstra
2006-09-12 15:25 ` [PATCH 07/20] nfs: add a comment explaining the use of PG_private in the NFS client Peter Zijlstra
2006-09-12 15:25 ` [PATCH 17/20] scsi: propagate the swapdev hook into the scsi stack Peter Zijlstra
2006-09-12 15:25 ` [PATCH 06/20] nfs: teach the NFS client how to treat PG_swapcache pages Peter Zijlstra
2006-09-12 15:25 ` [PATCH 05/20] uml: rename arch/um remove_mapping() Peter Zijlstra
2006-09-12 15:25 ` [PATCH 09/20] nfs: make swap on NFS robust Peter Zijlstra
2006-09-12 15:25 ` [PATCH 14/20] uml: enable scsi and add iscsi config Peter Zijlstra
2006-09-12 15:25 ` [PATCH 03/20] mm: add support for non block device backed swap files Peter Zijlstra
2006-09-12 15:25 ` [PATCH 12/20] nbd: limit blk_queue Peter Zijlstra
2006-09-12 22:47   ` Jens Axboe
2006-09-12 15:25 ` [PATCH 13/20] nbd: use swapdev hook to make swap deadlock free Peter Zijlstra
2006-09-12 15:25 ` [PATCH 01/20] mm: serialize access to min_free_kbytes Peter Zijlstra
2006-09-12 15:25 ` [PATCH 04/20] mm: methods for teaching filesystems about PG_swapcache pages Peter Zijlstra
2006-09-12 15:25 ` [PATCH 11/20] nbd: request_fn fixup Peter Zijlstra
2006-09-12 22:47   ` Jens Axboe
2006-09-13  0:21     ` Jeff Garzik
2006-09-13  6:14       ` Jens Axboe
2006-09-12 15:25 ` [PATCH 15/20] iscsi: kernel side tcp connect Peter Zijlstra
2006-09-12 16:37 ` [PATCH 00/20] vm deadlock avoidance for NFS, NBD and iSCSI (take 7) Linus Torvalds
2006-09-12 23:58   ` Nate Diller

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=20060912144905.106019000@chello.nl \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=netdev@vger.kernel.org \
    --cc=phillips@google.com \
    --cc=riel@redhat.com \
    --cc=torvalds@osdl.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