Re: [PATCH v2 2/3] mm: huge_memory: refactor anon_enabled_store() with change_anon_orders()
From: Baolin Wang
Date: Fri Mar 06 2026 - 21:23:53 EST
On 3/6/26 7:22 PM, Lorenzo Stoakes (Oracle) wrote:
On Fri, Mar 06, 2026 at 02:30:22AM -0800, Breno Leitao wrote:
On Fri, Mar 06, 2026 at 02:07:50PM +0800, Baolin Wang wrote:
+ mode = sysfs_match_string(enabled_mode_strings, buf);
+ if (mode < 0)
+ return -EINVAL;
- if (ret > 0) {
- int err;
+ if (change_anon_orders(order, mode)) {
+ int err = start_stop_khugepaged();
Thanks for the cleanup, and the code looks better.
- err = start_stop_khugepaged();
if (err)
- ret = err;
+ return err;
+ } else {
+ /*
+ * Recalculate watermarks even when the mode didn't
+ * change, as the previous code always called
+ * start_stop_khugepaged() which does this internally.
+ */
+ set_recommended_min_free_kbytes();
However, this won't fix your issue. You will still get lots of warning
messages even if no hugepage options are changed.
Correct — this was part of the earlier discussion, where the suggestion
was to retain the set_recommended_min_free_kbytes() call even when it
is a no-op.
As for the warnings, I see a few possible approaches:
* Remove them entirely — are they providing any real value?
* Apply rate limiting to reduce the noise
I think rate limiting is the sensible approach.
+1. Make sense to me.