From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8058C433E1 for ; Tue, 16 Jun 2020 11:24:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8AD4320734 for ; Tue, 16 Jun 2020 11:24:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AD4320734 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E7CD76B008A; Tue, 16 Jun 2020 07:24:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E06FC6B008C; Tue, 16 Jun 2020 07:24:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCDC96B0092; Tue, 16 Jun 2020 07:24:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id B0AFA6B008A for ; Tue, 16 Jun 2020 07:24:35 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4F401180AD806 for ; Tue, 16 Jun 2020 11:24:35 +0000 (UTC) X-FDA: 76934842110.20.eggs78_160c58d26dfe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 2CCC7180C07A3 for ; Tue, 16 Jun 2020 11:24:35 +0000 (UTC) X-HE-Tag: eggs78_160c58d26dfe X-Filterd-Recvd-Size: 4421 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Tue, 16 Jun 2020 11:24:34 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B2DD2AEAA; Tue, 16 Jun 2020 11:24:36 +0000 (UTC) Subject: Re: [PATCH] mm: fix swap cache node allocation mask To: Hugh Dickins , Andrew Morton Cc: Chris Murphy , Matthew Wilcox , Linux Memory Management List , Chris Wilson References: From: Vlastimil Babka Message-ID: <852dcf2a-9773-84ca-ae52-97eca40d1f96@suse.cz> Date: Tue, 16 Jun 2020 13:24:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2CCC7180C07A3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/15/20 10:35 PM, Hugh Dickins wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=208085 reports that a > slightly overcommitted load, testing swap and zram along with i915, > splats and keeps on splatting, when it had better fail less noisily: > > gnome-shell: page allocation failure: order:0, > mode:0x400d0(__GFP_IO|__GFP_FS|__GFP_COMP|__GFP_RECLAIMABLE), > nodemask=(null),cpuset=/,mems_allowed=0 > CPU: 2 PID: 1155 Comm: gnome-shell Not tainted 5.7.0-1.fc33.x86_64 #1 > Call Trace: > dump_stack+0x64/0x88 > warn_alloc.cold+0x75/0xd9 > __alloc_pages_slowpath.constprop.0+0xcfa/0xd30 > __alloc_pages_nodemask+0x2df/0x320 > alloc_slab_page+0x195/0x310 > allocate_slab+0x3c5/0x440 > ___slab_alloc+0x40c/0x5f0 > __slab_alloc+0x1c/0x30 > kmem_cache_alloc+0x20e/0x220 > xas_nomem+0x28/0x70 > add_to_swap_cache+0x321/0x400 > __read_swap_cache_async+0x105/0x240 > swap_cluster_readahead+0x22c/0x2e0 > shmem_swapin+0x8e/0xc0 > shmem_swapin_page+0x196/0x740 > shmem_getpage_gfp+0x3a2/0xa60 > shmem_read_mapping_page_gfp+0x32/0x60 > shmem_get_pages+0x155/0x5e0 [i915] > __i915_gem_object_get_pages+0x68/0xa0 [i915] > i915_vma_pin+0x3fe/0x6c0 [i915] > eb_add_vma+0x10b/0x2c0 [i915] > i915_gem_do_execbuffer+0x704/0x3430 [i915] > i915_gem_execbuffer2_ioctl+0x1ea/0x3e0 [i915] > drm_ioctl_kernel+0x86/0xd0 [drm] > drm_ioctl+0x206/0x390 [drm] > ksys_ioctl+0x82/0xc0 > __x64_sys_ioctl+0x16/0x20 > do_syscall_64+0x5b/0xf0 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > Reported on 5.7, but it goes back really to 3.1: when > shmem_read_mapping_page_gfp() was implemented for use by i915, and > allowed for __GFP_NORETRY and __GFP_NOWARN flags in most places, but > missed swapin's "& GFP_KERNEL" mask for page tree node allocation in > __read_swap_cache_async() - that was to mask off HIGHUSER_MOVABLE bits > from what page cache uses, but GFP_RECLAIM_MASK is now what's needed. > > Fixes: 68da9f055755 ("tmpfs: pass gfp to shmem_getpage_gfp") > Reported-by: Chris Murphy > Analyzed-by: Vlastimil Babka > Analyzed-by: Matthew Wilcox > Tested-by: Chris Murphy > Signed-off-by: Hugh Dickins > Reviewed-by: Matthew Wilcox (Oracle) > Cc: stable@vger.kernel.org # 3.1+ Reviewed-by: Vlastimil Babka Thanks! > --- > > mm/swap_state.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- 5.8-rc1/mm/swap_state.c 2020-06-14 15:13:01.518042420 -0700 > +++ linux/mm/swap_state.c 2020-06-15 11:48:02.346691901 -0700 > @@ -21,7 +21,7 @@ > #include > #include > #include > - > +#include "internal.h" > > /* > * swapper_space is a fiction, retained to simplify the path through > @@ -429,7 +429,7 @@ struct page *__read_swap_cache_async(swp > __SetPageSwapBacked(page); > > /* May fail (-ENOMEM) if XArray node allocation failed. */ > - if (add_to_swap_cache(page, entry, gfp_mask & GFP_KERNEL)) { > + if (add_to_swap_cache(page, entry, gfp_mask & GFP_RECLAIM_MASK)) { > put_swap_page(page, entry); > goto fail_unlock; > } >