linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: wujing <realwujing@qq.com>
To: Lance Yang <lance.yang@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <jackmanb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Qiliang Yuan <yuanql9@chinatelecom.cn>,
	wujing <realwujing@qq.com>
Subject: Re: [PATCH 1/1] mm/page_alloc: auto-tune min_free_kbytes on atomic allocation failure
Date: Mon,  5 Jan 2026 15:29:04 +0800	[thread overview]
Message-ID: <tencent_8CE8292766552797836FEB198A402CA2CF06@qq.com> (raw)
In-Reply-To: <20260105063830.15140-1-lance.yang@linux.dev>

Hi Lance,

Thanks for the suggestion about using watermark_scale_factor instead of 
min_free_kbytes. I appreciate the feedback, and I'd like to explain why I 
believe min_free_kbytes is the correct knob to tune for this specific problem.

## The Core Issue

The failures we're observing are GFP_ATOMIC, order-0 allocations in interrupt 
context (network packet reception). From the logs:

  [38535649.655527] swapper/100: page allocation failure: order:0, mode:0x480020(GFP_ATOMIC)

These allocations:
1. Cannot sleep or wait for memory reclaim
2. Can only use memory below the MIN watermark (the emergency reserve)
3. Fail when even this emergency reserve is exhausted

## Why watermark_scale_factor Won't Help

watermark_scale_factor controls the distance between MIN and LOW watermarks. 
It makes kswapd wake up earlier (at LOW instead of closer to MIN), which is 
great for preventing memory pressure.

However, for GFP_ATOMIC allocations:
- They don't wait for kswapd
- They only care about the MIN watermark itself
- A larger LOW-MIN gap doesn't increase the atomic reserve

Even if kswapd wakes up 10 seconds earlier due to a higher 
watermark_scale_factor, network interrupt bursts happen in milliseconds, 
leaving no time for reclaim.

## Why min_free_kbytes Is Necessary

min_free_kbytes directly controls the MIN watermark — the actual memory 
reserved for atomic allocations. Increasing it immediately makes more memory 
available for GFP_ATOMIC, which is what we need.

## Alternative: Hybrid Approach?

That said, your point about side effects is valid. One option could be:
1. Increase min_free_kbytes for immediate relief during failures
2. Also increase watermark_scale_factor slightly to make kswapd more aggressive
3. This could reduce the frequency of hitting MIN in the first place

Would this hybrid approach address your concerns?

Thanks again for the thoughtful review!

Best regards,
Wujing



  reply	other threads:[~2026-01-05  7:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 12:23 [PATCH 0/1] mm/page_alloc: dynamic min_free_kbytes adjustment wujing
2026-01-04 12:26 ` [PATCH 1/1] mm/page_alloc: auto-tune min_free_kbytes on atomic allocation failure wujing
2026-01-04 18:14   ` Andrew Morton
2026-01-05  2:32     ` Matthew Wilcox
2026-01-05  6:38   ` Lance Yang
2026-01-05  7:29     ` wujing [this message]
2026-01-05 16:47       ` Michal Hocko
2026-01-05  8:17 ` [PATCH v2 0/1] mm/page_alloc: dynamic min_free_kbytes adjustment wujing
2026-01-05 11:59 ` [PATCH v3 0/1] mm/page_alloc: dynamic watermark boosting wujing
     [not found] ` <20260105115943.1361645-1-realwujing@qq.com>
2026-01-05 11:59   ` [PATCH v3 1/1] mm/page_alloc: auto-tune watermarks on atomic allocation failure wujing

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=tencent_8CE8292766552797836FEB198A402CA2CF06@qq.com \
    --to=realwujing@qq.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=lance.yang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=yuanql9@chinatelecom.cn \
    --cc=ziy@nvidia.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