Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11542073rwl; Tue, 3 Jan 2023 00:25:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0BdekRljlqn/mYkns76gUU6aSUnYNZ6JY0b8a+tK+JlUtdio1hb336f+qGAHDP7CDr5AI X-Received: by 2002:a17:902:b713:b0:190:c550:d295 with SMTP id d19-20020a170902b71300b00190c550d295mr44437314pls.9.1672734357287; Tue, 03 Jan 2023 00:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672734357; cv=none; d=google.com; s=arc-20160816; b=XW2K+Larh5R/C1JW6v19OtjDeBx9Jf3cRoZDCQJPetFvo465mFlhWtrqtNbDFWuvaW +nn7rwRQK8gbbet5qrY0agvoEo/IxwcumG571ND6EW8cpavAooLis0Tbc/axWn8g29+O +bgM3B9pMCBIJJKnEYAetXoRPI7eR9QmbiDKKJ98p9uepiTKUxqTHp+ZTxdl2lsuQDou 5ta/8YWioglJeS98uVQGaY02W6ihaOgJWFCm/+C6TRzCjG/igLaO7WzRSHsK8VqHYf16 xSwiKPwKIYdae7fUIZn3oO0S8HOCyPCPGNe2vJjvHaiyFoh2mFu72oALRbEjkJ05GHaM WVMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/Ulj1KdXgOhz3mFb7YsOBfrLohsk+mOcfQTC8VIBIyY=; b=gTGjUOub4Ijg+zd81Ms57vd7fG159jX+9B/HzoyNKr7siWgYF49iCm0hiHV1RdvIVW YaWvyaDHYaTyti34tl9uzpmd9I3eTYobjEcQgZGpxFS+BlmRnQdPG4RxGViKMDLT/mdO Opk+4DiieewCblIMjpG9A9Z9XgPrJjuMtpXGRgPZmrG9HhoCmJ59iraw3SorwLD+pnjP BlCg13+Yh09alcjo3WC7f7k4m0HUY1a71pC08vf7NFgjoxErwrsn1WohcH3Acioh1jk/ mdEj+1UsyrPIb5uXE8Mv8FfZ1uFn8GZj8BIl6Cm9yuxSU8F3gYj55TFdooWvO9JTA+w+ iKOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=A6ezqKSa; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x23-20020a170902b41700b00186e3781ae2si30318701plr.316.2023.01.03.00.25.49; Tue, 03 Jan 2023 00:25:57 -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=@suse.com header.s=susede1 header.b=A6ezqKSa; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236942AbjACIDl (ORCPT + 61 others); Tue, 3 Jan 2023 03:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236729AbjACIDj (ORCPT ); Tue, 3 Jan 2023 03:03:39 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D105D1D8 for ; Tue, 3 Jan 2023 00:03:36 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B99C234367; Tue, 3 Jan 2023 08:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1672733014; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ulj1KdXgOhz3mFb7YsOBfrLohsk+mOcfQTC8VIBIyY=; b=A6ezqKSaMS5FkyAjD92Oqzp58vLYYNOst800s7iKTLxeX/W4EsZZj7Nh/qSNHuIdbQw+8v UVQ+ITlICX/hTuNaWhltgnIb9FvIy7AYAYqlXIAYs3WxNcImmf0lJnQEjkd2urmE5lfUG/ PyH7UWhKQGzTcA2wqg0h0mFWznyD8LE= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 99742139F1; Tue, 3 Jan 2023 08:03:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id a1ktI1bhs2O0eQAAMHmgww (envelope-from ); Tue, 03 Jan 2023 08:03:34 +0000 Date: Tue, 3 Jan 2023 09:03:33 +0100 From: Michal Hocko To: Jaewon Kim Cc: riel@redhat.com, redkoi@virtuozzo.com, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com Subject: Re: [PATCH] page_alloc: avoid the negative free for meminfo available Message-ID: References: <20230103072807.19578-1-jaewon31.kim@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230103072807.19578-1-jaewon31.kim@samsung.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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 On Tue 03-01-23 16:28:07, Jaewon Kim wrote: > 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. What is the actual problem you are trying to address by this change? > 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 -- Michal Hocko SUSE Labs