From patchwork Tue Jan 3 07:28:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 13087268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD820C46467 for ; Tue, 3 Jan 2023 07:28:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 255478E0002; Tue, 3 Jan 2023 02:28:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 205998E0001; Tue, 3 Jan 2023 02:28:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CFA98E0002; Tue, 3 Jan 2023 02:28:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F1A8F8E0001 for ; Tue, 3 Jan 2023 02:28:42 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CE24240585 for ; Tue, 3 Jan 2023 07:28:42 +0000 (UTC) X-FDA: 80312660484.03.00C8688 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by imf10.hostedemail.com (Postfix) with ESMTP id BCFACC0005 for ; Tue, 3 Jan 2023 07:28:39 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=iMOzyZt+; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf10.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.24 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672730920; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:references:dkim-signature; bh=eGleB0WkzSKoVjSc8z+2+zO9HAuRkuvhJZWvCINDNyQ=; b=rGyTy+jo+c04WZpaZE/FrFjjWsFBwCfflGgeqj1iaiWYyaQ45ilvalDTb9+gWb2OlU1voV a7mN2KU7tcDSQ4YjyWc9nHDG1acyvqYl2XvYz+haVJis0sy3vK2joYjJr92Yt6TN1t02OV U0plKWyb//Tpy8lh+B2+cOCfjhAf4Yc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=iMOzyZt+; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf10.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.24 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672730920; a=rsa-sha256; cv=none; b=bYi4JydjyBZefxNDVI9JW8hRUcvDnGg42eSPfdVnjSW7XGvljVuUtH9nnlHjzESvSSe6iW gEBX7BSmBIndb51QdPscHgaUfa/puDQJtP3QvJI1W/dVpFyshCLmonsxEAxnHyUqN+W6sg mFTLtkfz+NAZJ57EM7meeTTqRXgFhMY= Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230103072836epoutp01215b66347a7182bb8d3ea4328d217700~2u_fZO_zZ2251522515epoutp01O for ; Tue, 3 Jan 2023 07:28:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230103072836epoutp01215b66347a7182bb8d3ea4328d217700~2u_fZO_zZ2251522515epoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1672730916; bh=eGleB0WkzSKoVjSc8z+2+zO9HAuRkuvhJZWvCINDNyQ=; h=From:To:Cc:Subject:Date:References:From; b=iMOzyZt+bc0wWzJYExfeW6xsGthQYeUkxzRQQJYRLCV+eOficIKqrBYa5bUGtOQTj nKSa4+7BFmynQNyy0tyla5QiBG2w2XXuePGAeqGoc8OwekvT1ODnKc/EaoF5LdpEj6 aX7b+0tH9kh1T++qR5URe1auiblDrEQ6OWng1Xls= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20230103072835epcas1p4ed9ed9da2abbbb4b8def9320aa88d555~2u_epiPyW0485904859epcas1p4W; Tue, 3 Jan 2023 07:28:35 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.38.242]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4NmPVC1FVbz4x9QD; Tue, 3 Jan 2023 07:28:35 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 89.6A.19973.329D3B36; Tue, 3 Jan 2023 16:28:35 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e~2u_eVYf7n3260832608epcas1p37; Tue, 3 Jan 2023 07:28:34 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230103072834epsmtrp269cd492211b8bf6d96c6ed818ec8bea8~2u_eUhUhJ3213832138epsmtrp2W; Tue, 3 Jan 2023 07:28:34 +0000 (GMT) X-AuditID: b6c32a35-f09ff70000014e05-16-63b3d923ad9c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 79.F5.10542.229D3B36; Tue, 3 Jan 2023 16:28:34 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.100.104]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230103072834epsmtip169b02d5592f8a4c123b73b41a729f122~2u_eIA3g80565105651epsmtip1i; Tue, 3 Jan 2023 07:28:34 +0000 (GMT) From: Jaewon Kim To: riel@redhat.com, redkoi@virtuozzo.com, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH] page_alloc: avoid the negative free for meminfo available Date: Tue, 3 Jan 2023 16:28:07 +0900 Message-Id: <20230103072807.19578-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFKsWRmVeSWpSXmKPExsWy7bCmvq7yzc3JBmf/sVvMWb+GzWL1Jl+L 7s0zGS16379isri8aw6bxb01/1ktXn9bxmzxu/kyi8XfK+tZHDg9Dr95z+yxc9Zddo9NqzrZ PDZ9msTucWLGbxaP9/uusnn0bVnF6PF5k5zH6/2HGAM4o7JtMlITU1KLFFLzkvNTMvPSbZW8 g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0yc4BuVFIoS8wpBQoFJBYXK+nb2RTll5akKmTk F5fYKqUWpOQUmBXoFSfmFpfmpevlpZZYGRoYGJkCFSZkZ9zefY6t4BRrxfmlJ9kbGPexdDFy ckgImEhMuDqTuYuRi0NIYAejxLKZM9kgnE+MEru2PITKfGaUON+yhBmmZc/TlVBVuxglXiw8 xwrh/GCU2HDvHyNIFZuAtsT7BZNYQWwRgVyJloVHmEBsZoFSibdvToBNEhbwkjjxsJEdxGYR UJWYsnYNG4jNK2Arcf3iTVaIbfISqzccgNp8i13iwCd2CNtF4vStv4wQtrDEq+NboOJSEp/f 7WWDsLMlnp48AtTLAWTnSDRskIUw7SXeX7IAMZkFNCXW79KHKFaU2Pl7LiPEkXwS7772sEJU 80p0tAlBlKhJtDz7CnWXjMTff8+gbA+JyeengANUSCBWYtqHiUwTGGVnISxYw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e6DoZLySQnliSmp2aWpBaBJNl4uCUamBynb/q/Q72Cbv1D73c+i6j5Pi0e8aH958RCItK tVnFxTnJKYDn8gV36VdShvpvG/oqHh4Xsa0tPJXz9LbW9TrWIz0y9juNJ61LlLmZwrdgZjtD hfuOrNJPQrqsW/Ysm9gleGGq75/VGTOckhL1O43dhLv7bpW++vbtPcvMDSY75M71ZRf8UFrc Jnu0I+m0e1moeaAjr+6N7RNFHY7OXan0e03X/VmfmMp8z7Gk7PB+Knhb/ERd2HfWr/fP8Gub BKxf88+7t5z5drbjZCH1t+y/vyjq3Um9LVKpufXl7BmVj7mUX4WJLuPsrzmexFis/m3SryMf ne6UMkT/yxeNdC1522sjtuXMl/6+3eKr/7kpsRRnJBpqMRcVJwIAzUxQ7q4CAAA= X-CMS-MailID: 20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e References: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BCFACC0005 X-Stat-Signature: xar1g5e4qp18woe7m8j6bgi9dsjpq6df X-HE-Tag: 1672730919-630872 X-HE-Meta: U2FsdGVkX19YlnKAiw2Cmfco4R8OLIHQjtu0u6og1hWkPYQZRStLxvANrUSOl4sORJDPd7yxmWK0MFraS3rXPEBJ+v+RBhPLollSyykVDVRVao3PNb8Wo7PK5OnSWtCOdAKrndjEyCNeOBR/HSQrl6sid81RRTRTV2N4VMqSujJUcEunblW5GC9vtt8YdayiFxD7uxhu1GEiP9itVFgytslXHnE9DGQzUXrg0sGLIrdzsOUYybyh/uSpReOhAl4ZLM+E6C1v+jaIQs+Gp/H3QTjZSFwtWZkdIeBZhikou8BAJuYjLPfjtwZrWGBAnX0xcBz9Ul7pTpnGcuK0W5YIm2wfXdKzSTR2E4NQuousnCI9LCdR3zY/MisZsf4FjgBLUMvGyzinGoq84rnPMhDzoeOWee4iVpkTIgUD5E0bCm5A0b+wEieurr8jty2hHZ9IdVIPkQOCThKN6F8HQVhMBnUmR5SBNQtezDbhlHSCuvjQvYgAnClbJPrIIUEWLwh1kOTeYszLavXiakvi4Zpn4kD87HiM0OkqaQUyy6wV+i7hRTh/JGtP6Q6Cb21A+zY4sROgRMzUbiYMFrMpvNi+uZrSyfxkaTHApjH8KE1To24m964gVACqHE2YfeQtOhHNUvHycn4EOtui2KhuGS/ZiDjv2aFHEps6Arb+u1UIH6CAF5HGuIoyyLbcSsCO8toReEKcWMl0SiIsgVHp1gjtFjwLayo+ySDdsWnltJ0DmooaVppdwSQgGShehzjSnECYjfJbMm05vu2HstZamqbwYXU0wMN+mRUjhOLWScq+v5bFlUgHDONKu5362mI5j+LN6xyC+v75btHKphUTzY+CRLNBEaOjiO6fvpML9qBfodDTZYLSW28k068qkcrXCOvhqCw+luGyrYkYb+ADveq47IETfuRweEXcWjqWL4g+2HXpOeYOv1Dx/JDOfyDsYHG7t2dzHIzihEczmoyOdnm hTdb9S1V 8j5pmKBYxTt8bhh14FmbO8iLcUfWNAYjZO4IBWXe6Inv/5wySnav5D7EIJvMiDmSi8VMWVo9VCsz2/qO4YU+Z7S+PZss+3EKZfk9nrnnNe421bgaM/W1ILrnv0TsRHnGlAxyWeqj+Xnc8HFrS3jcBSEaJ7T7t8i1QE2Rajq1d7XkAK2c= 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: The totalreserve_pages could be higher than the free because of watermark high or watermark boost. Handle this situation and fix it to 0 free size. Signed-off-by: Jaewon Kim --- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 218b28ee49ed..e510ae83d5f3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5948,6 +5948,8 @@ long si_mem_available(void) * without causing swapping or OOM. */ available = global_zone_page_state(NR_FREE_PAGES) - totalreserve_pages; + if (available < 0) + available = 0; /* * Not all the page cache can be freed, otherwise the system will