On 9/25/2020 12:42 AM, Michal Hocko wrote:
On Wed 16-09-20 18:21:48, Vijay Balakrishna wrote:
When memory is hotplug added or removed the min_free_kbytes must be
recalculated based on what is expected by khugepaged. Currently
after hotplug, min_free_kbytes will be set to a lower default and higher
default set when THP enabled is lost. This change restores min_free_kbytes
as expected for THP consumers.
Fixes: f000565adb77 ("thp: set recommended min free kbytes")
Signed-off-by: Vijay Balakrishna <vijayb@xxxxxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
I am ok with this patch. I am not sure this is worth backporting to
stable trees becasuse this is not a functional bug. Surprising behavior,
yes, but not much more than that.
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Thanks Michal.
One minor comment below
[...]
@@ -857,6 +858,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,
zone_pcp_update(zone);
init_per_zone_wmark_min();
+ khugepaged_min_free_kbytes_update();
kswapd_run(nid);
kcompactd_run(nid);
@@ -1600,6 +1602,7 @@ static int __ref __offline_pages(unsigned long start_pfn,
pgdat_resize_unlock(zone->zone_pgdat, &flags);
init_per_zone_wmark_min();
+ khugepaged_min_free_kbytes_update();
if (!populated_zone(zone)) {
zone_pcp_reset(zone);
Can we move khugepaged_min_free_kbytes_update into
init_per_zone_wmark_min? If it stays external we might hit the same
problem when somebody else needs to modify min_free_kbytes. Early init
call will be likely too early for khugepaged but that shouldn't matter
AFAICS because it will call khugepaged_min_free_kbytes_update on its
own.
Sure, let me take a look and post v4 next week.
Thanks,
Vijay