Commit 193ae036 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] suppress more allocation failure warnings

The `page allocation failure' warning in __alloc_pages() is being a
pain.  But I'm persisting with it...

The patch renames PF_RADIX_TREE to PF_NOWARN, and uses it in a few
places where allocations failures are known to happen.  These code
paths are well-tested now and suppressing the warning is OK.
parent a2b41d23
...@@ -2481,7 +2481,9 @@ struct scatterlist *scsi_alloc_sgtable(Scsi_Cmnd *SCpnt, int gfp_mask) ...@@ -2481,7 +2481,9 @@ struct scatterlist *scsi_alloc_sgtable(Scsi_Cmnd *SCpnt, int gfp_mask)
sgp = scsi_sg_pools + SCpnt->sglist_len; sgp = scsi_sg_pools + SCpnt->sglist_len;
current->flags |= PF_NOWARN;
sgl = mempool_alloc(sgp->pool, gfp_mask); sgl = mempool_alloc(sgp->pool, gfp_mask);
current->flags &= ~PF_NOWARN;
if (sgl) { if (sgl) {
memset(sgl, 0, sgp->size); memset(sgl, 0, sgp->size);
return sgl; return sgl;
......
...@@ -135,21 +135,26 @@ inline void bio_init(struct bio *bio) ...@@ -135,21 +135,26 @@ inline void bio_init(struct bio *bio)
**/ **/
struct bio *bio_alloc(int gfp_mask, int nr_iovecs) struct bio *bio_alloc(int gfp_mask, int nr_iovecs)
{ {
struct bio *bio = mempool_alloc(bio_pool, gfp_mask); struct bio *bio;
struct bio_vec *bvl = NULL; struct bio_vec *bvl = NULL;
current->flags |= PF_NOWARN;
bio = mempool_alloc(bio_pool, gfp_mask);
if (unlikely(!bio)) if (unlikely(!bio))
return NULL; goto out;
if (!nr_iovecs || (bvl = bvec_alloc(gfp_mask,nr_iovecs,&bio->bi_max))) { if (!nr_iovecs || (bvl = bvec_alloc(gfp_mask,nr_iovecs,&bio->bi_max))) {
bio_init(bio); bio_init(bio);
bio->bi_destructor = bio_destructor; bio->bi_destructor = bio_destructor;
bio->bi_io_vec = bvl; bio->bi_io_vec = bvl;
return bio; goto out;
} }
mempool_free(bio, bio_pool); mempool_free(bio, bio_pool);
return NULL; bio = NULL;
out:
current->flags &= ~PF_NOWARN;
return bio;
} }
/** /**
......
...@@ -965,7 +965,9 @@ create_buffers(struct page * page, unsigned long size, int retry) ...@@ -965,7 +965,9 @@ create_buffers(struct page * page, unsigned long size, int retry)
head = NULL; head = NULL;
offset = PAGE_SIZE; offset = PAGE_SIZE;
while ((offset -= size) >= 0) { while ((offset -= size) >= 0) {
current->flags |= PF_NOWARN;
bh = alloc_buffer_head(); bh = alloc_buffer_head();
current->flags &= ~PF_NOWARN;
if (!bh) if (!bh)
goto no_grow; goto no_grow;
......
...@@ -386,7 +386,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) ...@@ -386,7 +386,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
#define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */ #define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */
#define PF_FREE_PAGES 0x00002000 /* per process page freeing */ #define PF_FREE_PAGES 0x00002000 /* per process page freeing */
#define PF_FLUSHER 0x00004000 /* responsible for disk writeback */ #define PF_FLUSHER 0x00004000 /* responsible for disk writeback */
#define PF_RADIX_TREE 0x00008000 /* debug: performing radix tree alloc */ #define PF_NOWARN 0x00008000 /* debug: don't warn if alloc fails */
#define PF_FREEZE 0x00010000 /* this task should be frozen for suspend */ #define PF_FREEZE 0x00010000 /* this task should be frozen for suspend */
#define PF_IOTHREAD 0x00020000 /* this thread is needed for doing I/O to swap */ #define PF_IOTHREAD 0x00020000 /* this thread is needed for doing I/O to swap */
......
...@@ -399,7 +399,7 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_ ...@@ -399,7 +399,7 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_
return page; return page;
} }
nopage: nopage:
if (!(current->flags & PF_RADIX_TREE)) { if (!(current->flags & PF_NOWARN)) {
printk("%s: page allocation failure." printk("%s: page allocation failure."
" order:%d, mode:0x%x\n", " order:%d, mode:0x%x\n",
current->comm, order, gfp_mask); current->comm, order, gfp_mask);
......
...@@ -63,7 +63,7 @@ swap_out_add_to_swap_cache(struct page *page, swp_entry_t entry) ...@@ -63,7 +63,7 @@ swap_out_add_to_swap_cache(struct page *page, swp_entry_t entry)
int ret; int ret;
current->flags &= ~PF_MEMALLOC; current->flags &= ~PF_MEMALLOC;
current->flags |= PF_RADIX_TREE; current->flags |= PF_NOWARN;
ClearPageUptodate(page); /* why? */ ClearPageUptodate(page); /* why? */
ClearPageReferenced(page); /* why? */ ClearPageReferenced(page); /* why? */
ret = add_to_swap_cache(page, entry); ret = add_to_swap_cache(page, entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment