Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp699294ybv; Thu, 13 Feb 2020 07:59:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzOgGigCbHfSmT7WGioZxyXmqz57WtN2G9PI9IMKUfXTjsvbyZkTxcI4ZdNkyNGLcoCZaeT X-Received: by 2002:a9d:7695:: with SMTP id j21mr14280083otl.157.1581609586680; Thu, 13 Feb 2020 07:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581609586; cv=none; d=google.com; s=arc-20160816; b=yAwPvDDnOgVIvjgSgg8O78fF7Xo4xk5dF5KinU3R7TVQF54OKRUVpnkt+2PvFJFyl9 g6adPd+HrS3hiJFAz18gfumNN3cA0HfAgnlJrcLz1eHXNXQme3cmCEqwGPfbe8aLPIdH dkGBtv9wCWlejJccisuPRmW6tMTN//yeivxaeWbHQCbWFuXahVCUVer7jCJDvlRqi4w6 HtmFPCP1cVET38bId3tyiWt9X8dQPk2rHS9zxfAuCXw3fpXMf+bwW+PMb5JKoghHXGrf nZIGL+1kgIY9yJAXJ8aN8cPO58Yb7Vt8fXYLOG9Oww8IQMR3Crqc+SHX0/tqebAx8uP8 1AfQ== 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=IrIfqmp2XOaCCHdoCtKcndMqpflr3WewX6zoFlM2zTc=; b=hAzRDu/MzhXPfW6pHC+/XqWQSbsqUm6W0i59srvY4UkxrDLVdrk4R9sVg2PLnaraiF DkiIJEcCwdL9nWrF+wer683ecPM+mvb6FJ9PRZ/6vSJjNL9AWFB0qJAi+wBswDagfJbV gF1chacdERyKFmlWSb99il50/Bm1ya5wwA2K6safJL+7BoOsSMPe0Zg9KEHIa1qAusLs KCfPA2Ut5QxVM8MnYlaUU+7TY1YF00/wKAYqHKDBDnVkyqhNWZhWoSPgDvbofb7M/iPJ sXexfC5uqRPBDLbeuFo7kOAYvNRnEdhyFRpwNMlkjW9JWiIJFrzeAAi2Om01w+Oz8pFl lJ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qqp4Ds2e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si1300912ota.259.2020.02.13.07.59.34; Thu, 13 Feb 2020 07:59:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qqp4Ds2e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728835AbgBMPYx (ORCPT + 99 others); Thu, 13 Feb 2020 10:24:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:34696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbgBMPX3 (ORCPT ); Thu, 13 Feb 2020 10:23:29 -0500 Received: from localhost (unknown [104.132.1.104]) (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 2693F24689; Thu, 13 Feb 2020 15:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607408; bh=8m95RymEldAFxdMNFNOh5ebIIqj+Gyn1fmABkibbhcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqp4Ds2eSKaMe01ZDQHWVv++O4+QxUMhOuGoAjjinxWlLGaGa9wq0HKW/GwNW/Xfh wqtb+hAFnnFFfE4C6h9/kCMuQscioChobqAgMBxKMUQR1LuY/WnWu+T+o2WSaCZyqG 1gvN6e3UtMzDbHXnrf5FQMEhJV0v57xiy9mqV0sQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Richard Weinberger , Sasha Levin Subject: [PATCH 4.9 028/116] ubifs: Change gfp flags in page allocation for bulk read Date: Thu, 13 Feb 2020 07:19:32 -0800 Message-Id: <20200213151853.797208951@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151842.259660170@linuxfoundation.org> References: <20200213151842.259660170@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: Hyunchul Lee [ Upstream commit 480a1a6a3ef6fb6be4cd2f37b34314fbf64867dd ] In low memory situations, page allocations for bulk read can kill applications for reclaiming memory, and print an failure message when allocations are failed. Because bulk read is just an optimization, we don't have to do these and can stop page allocations. Though this siutation happens rarely, add __GFP_NORETRY to prevent from excessive memory reclaim and killing applications, and __GFP_WARN to suppress this failure message. For this, Use readahead_gfp_mask for gfp flags when allocating pages. Signed-off-by: Hyunchul Lee Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- fs/ubifs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index b4fbeefba246a..f2e6162f8e656 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -721,6 +721,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu, int err, page_idx, page_cnt, ret = 0, n = 0; int allocate = bu->buf ? 0 : 1; loff_t isize; + gfp_t ra_gfp_mask = readahead_gfp_mask(mapping) & ~__GFP_FS; err = ubifs_tnc_get_bu_keys(c, bu); if (err) @@ -782,8 +783,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu, if (page_offset > end_index) break; - page = find_or_create_page(mapping, page_offset, - GFP_NOFS | __GFP_COLD); + page = find_or_create_page(mapping, page_offset, ra_gfp_mask); if (!page) break; if (!PageUptodate(page)) -- 2.20.1