From: Lorenzo Stoakes <lstoakes@gmail.com>
To: Jaewon Kim <jaewon31.kim@samsung.com>
Cc: riel@redhat.com, redkoi@virtuozzo.com, akpm@linux-foundation.org,
hannes@cmpxchg.org, mhocko@kernel.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
Date: Tue, 3 Jan 2023 07:35:32 +0000 [thread overview]
Message-ID: <Y7PaxPV3Ln7AXVSc@lucifer> (raw)
In-Reply-To: <20230103072807.19578-1-jaewon31.kim@samsung.com>
On Tue, Jan 03, 2023 at 04:28:07PM +0900, 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.
>
> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
> ---
> 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
>
We already reset to zero at the end of the function, wouldn't resetting to zero
here potentially skew the result?
next prev parent reply other threads:[~2023-01-03 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e@epcas1p3.samsung.com>
2023-01-03 7:28 ` Jaewon Kim
2023-01-03 7:35 ` Lorenzo Stoakes [this message]
[not found] ` <CGME20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e@epcms1p3>
2023-01-03 7:50 ` Jaewon Kim
2023-01-03 8:03 ` Michal Hocko
[not found] ` <CGME20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e@epcms1p6>
2023-01-03 8:20 ` 김재원
2023-01-03 8:32 ` (2) " Michal Hocko
[not found] ` <CGME20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e@epcms1p7>
2023-01-03 9:22 ` 김재원
2023-01-03 10:20 ` Michal Hocko
[not found] ` <CGME20230103072834epcas1p3441ef50a6cc26ac48d184f1244b76a0e@epcms1p5>
2023-01-03 10:39 ` 김재원
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y7PaxPV3Ln7AXVSc@lucifer \
--to=lstoakes@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jaewon31.kim@gmail.com \
--cc=jaewon31.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=redkoi@virtuozzo.com \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox