Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1122228ybt; Tue, 7 Jul 2020 08:15:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo1Y9uP7c7IB8iGmrslqUZasqWnKr+svZ7EELYbohIChEpdAIfy4kv13SlhaSdveqkfcLR X-Received: by 2002:a50:f086:: with SMTP id v6mr63384022edl.199.1594134950523; Tue, 07 Jul 2020 08:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594134950; cv=none; d=google.com; s=arc-20160816; b=HX7Qi3NpGDWTeO0WJHt/5Q3JgZsy5fV3pcHEZMFCx+zOtzw5XQYwxFdsyGTFZNg9kF kR/Ok9ll65NahhW6J2BiBe6WO5cehlpspksXXrT8rHPJrkD4dGctHZDTfFcTR3796noh 5zArI6zxx149UvitSJP/cenaFe6/UZgTJVg6lxGyghp0FB9uOeQFZi3vN0YgDdxxDbz/ 8QFSGVCPgHtyvTQlePuFwVWFFEq+UaEihTd9r9nn5ltByiyb99Yy/Yt4tMeMYPijc1+7 v1AuHcJsVjCtZKDwPXwSKs5xJjpcc67imB2TpO44YXhV21ncGeGCD1x71MZvdtCxKGul e8Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VSeenfUpiUuoXcofE1HDjNZefo8dZzx4ac+PO3uxFdQ=; b=FdRixXSOnxrWYI3ZoecqKgZ1iw+4Rd5vCx2uB2ER8T3VMowByFR6Ctc5Av4p8lFpil q3qRhgL1YqEMInS1MLRIwLYP5sC5JIQPZ1UraHr9rayQAbgEcp9y26KYUxhIOVonXOT9 oeGxRYpqBBmPQlXsHjz8+kR/VTCge+V58RjscOyNXKojsXa7H1kYBO57nX3GV1q4pHRa ImKEWfUebxV6vIZXXwnzJww9yDX2gkVfVPXlbs6NFstHJqLfZCic8Qjva1v0Z0V3IAEP WcwLOyo24GIPKZ4W1587JhjXxcB6+uU/Glqwt2PvXYLaQu+rCWxHpQjD0XQc9E+fXOX8 r54A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kNy2v+j4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si14597370edq.556.2020.07.07.08.15.27; Tue, 07 Jul 2020 08:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kNy2v+j4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728755AbgGGPOr (ORCPT + 99 others); Tue, 7 Jul 2020 11:14:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:54156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728742AbgGGPOq (ORCPT ); Tue, 7 Jul 2020 11:14:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 938DD2065D; Tue, 7 Jul 2020 15:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594134885; bh=bMIgGGwhvSawfOAj7SiOOHFGQHDHbpq1RNgtwDoTtP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNy2v+j47eJgC1mc+sb/cufJMhyy/sWawNuciO38AoaEbHsmm/lHcQAsdEIWAxxHc CqcW7akb+j5e8xyV6qU4YKuFfQTFSIRopiGtJvgqZPlBEtCf91hHFtLyVT7sGZPZmT Z5fTHwKwHmmGL8fdFRej0A0Wk5vc2iMpzUanu3Ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins , Vlastimil Babka , "Matthew Wilcox (Oracle)" , Chris Murphy , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.9 04/24] mm: fix swap cache node allocation mask Date: Tue, 7 Jul 2020 17:13:36 +0200 Message-Id: <20200707145749.167786208@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200707145748.952502272@linuxfoundation.org> References: <20200707145748.952502272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins [ Upstream commit 243bce09c91b0145aeaedd5afba799d81841c030 ] Chris Murphy 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. Link: https://bugzilla.kernel.org/show_bug.cgi?id=208085 Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2006151330070.11064@eggly.anvils Fixes: 68da9f055755 ("tmpfs: pass gfp to shmem_getpage_gfp") Signed-off-by: Hugh Dickins Reviewed-by: Vlastimil Babka Reviewed-by: Matthew Wilcox (Oracle) Reported-by: Chris Murphy Analyzed-by: Vlastimil Babka Analyzed-by: Matthew Wilcox Tested-by: Chris Murphy Cc: [3.1+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/swap_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index 35d7e0ee1c77c..f5cb6b23cedaf 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -19,6 +19,7 @@ #include #include +#include "internal.h" /* * swapper_space is a fiction, retained to simplify the path through @@ -326,7 +327,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, /* * call radix_tree_preload() while we can wait. */ - err = radix_tree_maybe_preload(gfp_mask & GFP_KERNEL); + err = radix_tree_maybe_preload(gfp_mask & GFP_RECLAIM_MASK); if (err) break; -- 2.25.1