--- a/mm/shmem.c~mm-shmem-use-proper-gfp-flags-for-shmem_writepage +++ a/mm/shmem.c @@ -1369,7 +1369,8 @@ static int shmem_writepage(struct page * if (list_empty(&info->swaplist)) list_add(&info->swaplist, &shmem_swaplist); - if (add_to_swap_cache(page, swap, GFP_ATOMIC) == 0) { + if (add_to_swap_cache(page, swap, + __GFP_HIGH | __GFP_NOMEMALLOC | __GFP_NOWARN) == 0) { spin_lock_irq(&info->lock); shmem_recalc_inode(inode); info->swapped++;