From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7952139F19A for ; Wed, 4 Mar 2026 10:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772619806; cv=none; b=s2v0FilYSx6HOKLJ52VkobImhIe+Hli0LldixQhrtxmBnPaQG+oO6kQI38tsKzTyaXXIIMv+dIKuqKVucbIUxf1daxbGbkJTwnvQ1ZwBuIk+MsKzH+W3Tz5oQipWixmD/MjxaeJ7SXOuzzE5stARVoHE1DpnbLJlfEwfy6MGExY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772619806; c=relaxed/simple; bh=PRTS0YWFCVoNZkpWsPM0Yc3J9V/U7IkkuXgM3/9GJeI=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=VyIzG39m0e3ilGLWQPXSxvG6A9oQx/PA71oinzkkqT6eBccaXkB039yqkqou0rfiAlvltqjfTC3uD8qD1NcjUVEDvLjkY3DaQ/pS0Xp7GrK3A6f/E1bl/0+uNnJnDI9GVLAjKS2cDPUaR2LkNB1+owqp1Aicyi8tPBky8zcaLjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=a5ug3J1W; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="a5ug3J1W" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:From:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=lj5MBj9ncBIFNCzED+GtuvP5PusClJ12tqeGukAFQGk=; b=a5ug3J1WkXImJf2RjxiTR1yiLj lFeE+7ZfEcJBXBjIFcsWvcQaF/JEJemO+4Som6qQkLA31tZm4fZCEoDAR+JFT3Bn/EQK1j1sYE1Fi 81hMXedSrRXqgHB5wgF0NT3KwIMZwgIvVRh4+cEMLvwb+Ad1Ahfb2p1bJcKyfGXhpeAjOTE+GVXU7 PvIFANpl5gfjb4yc/ipFVKzNyVcuFTVeaTPSYkOwVEhL9SquISiHESquVYr9GO77oWms/FULjbusS ONBcATbvJ8xZS0EpzdEO+ODMLvw9+xtqZ6eQnyVfqWNpLOrqCx4Mg75NHI/dkQUpJpdCgyxywgG02 iN1sy1Sw==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1vxjNl-00Ft46-1h; Wed, 04 Mar 2026 10:23:09 +0000 From: Breno Leitao Subject: [PATCH 0/2] mm: thp: reduce unnecessary start_stop_khugepaged() calls Date: Wed, 04 Mar 2026 02:22:32 -0800 Message-Id: <20260304-thp_logs-v1-0-59038218a253@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAOkHqGkC/yXMQQqDQAxG4auEf+1AqjjYuUopUp2oKUVlolIQ7 y6ty7f43g6TpGIItCPJpqbTiEC3jNAOr7EXpxGBkHPuueDCLcNcf6beHJf36JuKOx89MsKcpNP vf/V4Xm1r85Z2+Xkcxwk5f9PxbAAAAA== X-Change-ID: 20260303-thp_logs-059d6b80f6d6 To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, usamaarif642@gmail.com, kas@kernel.org, kernel-team@meta.com, Breno Leitao X-Mailer: b4 0.15-dev-f4305 X-Developer-Signature: v=1; a=openpgp-sha256; l=2078; i=leitao@debian.org; h=from:subject:message-id; bh=PRTS0YWFCVoNZkpWsPM0Yc3J9V/U7IkkuXgM3/9GJeI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpqAgHH9iIHniZ5nv4kv1Sc8en2rfakjyrdBHCG lJ5nulUhzKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaagIBwAKCRA1o5Of/Hh3 bQdPD/9K83EQKDrsQRC2sqEHMt+Y1EEwiRw8QRgPG5Iwe1gpJnc1YANslku6TzeaPzWy4TkmH9v Q+ixmOnUQ10Hyi+X84IQcV1UOqsJ2taIhNr2ynBy8MMYOMDH7xx5OkrfvxBBAlZTErY9ZukM+l9 qDFMkN+J6xofS5TaX/eCEcrsSkLUyYpM4foUcQL0zztF+g/HmXQbUutE8BkNWH2fdsgRQxZsTwz QXF/06wTdKPPmDd9ohIYTR28G7TsKyCPePzLlLSXxdpbA8OVXLyRqEUFeaiRVgwdyhewpuW3NkG WByjj1F0KDY+3G1Wu5TQKOK+pxdSBn1cH32OmZTlGKkARDzw09bAP2xH+Kj2khxpHKY4jZML5H3 +sm9JtXDshZ03ikfI4T/QXQs7DsiQtAtQ7XhMabjrYFwr90HTp33hUF13D9FcxRCan+yMYKB5Fj 4kJAXD4hpW4Am4Fc1V/tpHx94mR5IR02WD4zzbddAS40/DnRwxGGTKsbNJYkb0VrU7wZ6fGDdKg Ilv4qJM6v3j3bDIEGQWQ2d+Uwcoy1K48LbEo9+IYy5N9uvCNcnQpWsUItTuD+LR4q1m0eRo2TsW Q64d8c79cyTISOn8iOmaCX4GuEr5xWVheH3mJZf4p9hrBGFtpBtYfcWT3nyOEgAr74XM6zlcdEq 4tK928SUchdZ85A== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Writing to /sys/kernel/mm/transparent_hugepage/enabled causes start_stop_khugepaged() called independent of any change. start_stop_khugepaged() SPAMs the printk ring buffer overflow with the exact same message, even when nothing changes. For instance, if you have a custom vm.min_free_kbytes, just touching /sys/kernel/mm/transparent_hugepage/enabled causes a printk message. Example: # sysctl -w vm.min_free_kbytes=112382 # for i in $(seq 100); do echo never > /sys/kernel/mm/transparent_hugepage/enabled ; done and you have 100 WARN messages like the following, which is pretty dull: khugepaged: min_free_kbytes is not updated to 112381 because user defined value 112382 is preferred A similar message shows up when setting thp to "always": # for i in $(seq 100); do # echo 1024 > /proc/sys/vm/min_free_kbytes # echo always > /sys/kernel/mm/transparent_hugepage/enabled # done And then, we have 100K messages like: khugepaged: raising min_free_kbytes from 1024 to 67584 to help transparent hugepage allocations This is more common when you have a configuration management system that writes the THP configuration without an extra read, assuming that nothing will happen if there is no change in the configuration, but it prints these annoying messages. For instance, at Meta's fleet, ~10K servers were producing 3.5M of these messages per day. Fix this by doing two things: * Make the sysfs _store helpers a no-op if there is no state change * Ratelimit these messages to avoid SPAM on config change --- Breno Leitao (2): mm: thp: avoid calling start_stop_khugepaged() in anon_enabled_store() mm: thp: avoid calling start_stop_khugepaged() in enabled_store() mm/huge_memory.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) --- base-commit: 9dd5012f78d699f7a6051583dc53adeb401e28f0 change-id: 20260303-thp_logs-059d6b80f6d6 Best regards, -- Breno Leitao