Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11508682rwl; Mon, 2 Jan 2023 23:39:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMWpklOz9Sc5U1FM+2dmqVWvmtQhxH3g7pVDKlA9pxD781Eigc4MgLdBmt2gfbUUi2lQaR X-Received: by 2002:a05:6a20:d819:b0:b2:3b40:32b1 with SMTP id iv25-20020a056a20d81900b000b23b4032b1mr50373462pzb.57.1672731591380; Mon, 02 Jan 2023 23:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672731591; cv=none; d=google.com; s=arc-20160816; b=HIBaPhXT+G7CjlJRvd/ESCLXYTi902JwGx+M/+VB66+HTjwSiINa3GjGVNFivHEbdu pUi4eCm3pZEZtODfPw1p/JCqYbCTghSOueIKxqaiOQGLrBY766CwKU7d+PQKxildfs52 x5tUhN8Dlc38CPid10Y2pw7ogTAWaaNFD+IT2dxL1EN2SfVfpFcPAYR/zj8cebS2zUxa BDbthzAUxiU+FwtkexPu3baQbT5U7TAU9K0jik3spr/epZAzk3LFakypQw2xyL9ehQb7 CESFpoXSQ7wu0ukeUlMuy7UNpEb1AAWLrD9Kq/eyKXCW1Uj7emgwbL+36+7DF08yFXnq s5Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=eGleB0WkzSKoVjSc8z+2+zO9HAuRkuvhJZWvCINDNyQ=; b=ELXZUBoA6V6IIEgzVVgd+66tumED3IglJShZ159+9X4xxb3sbUdFsQJsd+lAHSvHjd B96Lr3OM1K/fxl9Omvs6R3K1NfrJnETt0vDqdXtJWLMMkFy0YyUMCLzDaJRDFBATSXSG zB+UQ/l7fHDKhD/YdU5hkpuxj3j335flQpunpdlDkQUAIUEFPhrrlUD5+k3ljBRGvbpQ KttfkpqmRzViM9dbAqcQ4qKN8DZtoYVzH9lrayvsRi+QvEynLqApWcCFq1nQrb+qXjbc g+bq2nXTCWMFMWcv+FXaqg0aDroK/IJ1xdUAYQbal/Z+S9iC4NpfE3GUVExJTdumJFp3 Yi/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=iMOzyZt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a63fa45000000b0049b36d5a275si20402149pgk.400.2023.01.02.23.39.42; Mon, 02 Jan 2023 23:39:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=iMOzyZt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236854AbjACH2l (ORCPT + 62 others); Tue, 3 Jan 2023 02:28:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbjACH2j (ORCPT ); Tue, 3 Jan 2023 02:28:39 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A93BB7D7 for ; Mon, 2 Jan 2023 23:28:38 -0800 (PST) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230103072836epoutp023de2a3258492e9c3b7b38c6a05c62718~2u_fi7_Gf0550105501epoutp02U for ; Tue, 3 Jan 2023 07:28:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230103072836epoutp023de2a3258492e9c3b7b38c6a05c62718~2u_fi7_Gf0550105501epoutp02U 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/TlV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NKT7A2M+1i6GDk5JARMJPY8XcnWxcjFISSwg1Fi4dkONoiEjMSb80+BijiAbGGJw4eL IWq+MUo0fTwEVsMmoC3xfsEkVhBbRKBY4vWHLmYQm1mgUuLf7VtgcWEBL4kTDxvZQWwWAVWJ KWvXgPXyCthKXL94kxVil7zE6g0HmCcw8ixgZFjFKJlaUJybnltsWGCUl1quV5yYW1yal66X nJ+7iREcflpaOxj3rPqgd4iRiYPxEKMEB7OSCO+kF5uShXhTEiurUovy44tKc1KLDzFKc7Ao ifNe6DoZLySQnliSmp2aWpBaBJNl4uCUamBynb/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 Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e References: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.17.1