diff options
author | Nathan Scott <nathans@sgi.com> | 2004-12-14 10:30:35 +1100 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-12-14 10:30:35 +1100 |
commit | 8978fa2c01d68d662332215acb12c34a4bb93ee4 (patch) | |
tree | fd8d29e234c701864fdb6347838ffea9d32ac212 /fs | |
parent | ba3afcc772ff68d4e732e906d7c15dfd5cceb284 (diff) | |
download | history-8978fa2c01d68d662332215acb12c34a4bb93ee4.tar.gz |
[XFS] Low memory allocation improvements (quietness and blockdev
congestion checks).
SGI-PV: 914873
SGI-Modid: xfs-linux:xfs-kern:20564a
Signed-off-by: Miquel van Smoorenburg <miquels@cistron.net>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 15 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 15 |
3 files changed, 18 insertions, 14 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index fae71765548640..364ea8c386b182 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c @@ -35,6 +35,7 @@ #include <linux/vmalloc.h> #include <linux/highmem.h> #include <linux/swap.h> +#include <linux/blkdev.h> #include "time.h" #include "kmem.h" @@ -46,7 +47,8 @@ void * kmem_alloc(size_t size, int flags) { - int retries = 0, lflags = kmem_flags_convert(flags); + int retries = 0; + int lflags = kmem_flags_convert(flags); void *ptr; do { @@ -57,8 +59,10 @@ kmem_alloc(size_t size, int flags) if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) return ptr; if (!(++retries % 100)) - printk(KERN_ERR "possible deadlock in %s (mode:0x%x)\n", + printk(KERN_ERR "XFS: possible memory allocation " + "deadlock in %s (mode:0x%x)\n", __FUNCTION__, lflags); + blk_congestion_wait(WRITE, HZ/50); } while (1); } @@ -102,7 +106,8 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags) void * kmem_zone_alloc(kmem_zone_t *zone, int flags) { - int retries = 0, lflags = kmem_flags_convert(flags); + int retries = 0; + int lflags = kmem_flags_convert(flags); void *ptr; do { @@ -110,8 +115,10 @@ kmem_zone_alloc(kmem_zone_t *zone, int flags) if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) return ptr; if (!(++retries % 100)) - printk(KERN_ERR "possible deadlock in %s (mode:0x%x)\n", + printk(KERN_ERR "XFS: possible memory allocation " + "deadlock in %s (mode:0x%x)\n", __FUNCTION__, lflags); + blk_congestion_wait(WRITE, HZ/50); } while (1); } diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index ffe383e14e36a0..14d594a949f4c8 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h @@ -83,7 +83,7 @@ typedef unsigned long xfs_pflags_t; static __inline unsigned int kmem_flags_convert(int flags) { - int lflags; + int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ #ifdef DEBUG if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) { diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index a86d2eb4004de4..c161db6c2ea2e1 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c @@ -53,13 +53,10 @@ #include <linux/workqueue.h> #include <linux/suspend.h> #include <linux/percpu.h> +#include <linux/blkdev.h> #include "xfs_linux.h" -#ifndef GFP_READAHEAD -#define GFP_READAHEAD (__GFP_NOWARN|__GFP_NORETRY) -#endif - /* * File wide globals */ @@ -118,8 +115,8 @@ ktrace_t *pagebuf_trace_buf; */ #define pb_to_gfp(flags) \ - (((flags) & PBF_READ_AHEAD) ? GFP_READAHEAD : \ - ((flags) & PBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL) + ((((flags) & PBF_READ_AHEAD) ? __GFP_NORETRY : \ + ((flags) & PBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL) | __GFP_NOWARN) #define pb_to_km(flags) \ (((flags) & PBF_DONT_BLOCK) ? KM_NOFS : KM_SLEEP) @@ -387,13 +384,13 @@ _pagebuf_lookup_pages( */ if (!(++retries % 100)) printk(KERN_ERR - "possible deadlock in %s (mode:0x%x)\n", + "XFS: possible memory allocation " + "deadlock in %s (mode:0x%x)\n", __FUNCTION__, gfp_mask); XFS_STATS_INC(pb_page_retries); pagebuf_daemon_wakeup(0, gfp_mask); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(10); + blk_congestion_wait(WRITE, HZ/50); goto retry; } |