Re: [patch] don't allocate ratnodes under PF_MEMALLOC
Christoph Hellwig (hch@infradead.org)
Sat, 13 Apr 2002 12:32:44 +0100
>
> /*
> + * On the swap_out path, the radix-tree node allocations are performing
> + * GFP_ATOMIC allocations under PF_MEMALLOC. They can completely
> + * exhaust the page allocator. This is bad; some pages should be left
> + * available for the I/O system to start sending the swapcache contents
> + * to disk.
> + *
> + * So PF_MEMALLOC is dropped here. This causes the slab allocations to fail
> + * earlier, so radix-tree nodes will then be allocated from the mempool
> + * reserves.
> + */
> +static inline int
> +swap_out_add_to_swap_cache(struct page *page, swp_entry_t entry)
> +{
> + int flags = current->flags;
> + int ret;
> +
> + current->flags &= ~PF_MEMALLOC;
> + ret = add_to_swap_cache(page, entry);
> + current->flags = flags;
> + return ret;
> +}
I don't like this soloution very - I think porting th add_to_swap() logic
from -rmap and implementing the flags fiddling in that function makes
more sense. I will do so once a -pre4 is out to resync.
Christoph
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/