From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 572DBC4363D for ; Fri, 25 Sep 2020 07:42:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C63D723600 for ; Fri, 25 Sep 2020 07:42:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="nhIX67r5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C63D723600 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 25A5C900002; Fri, 25 Sep 2020 03:42:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 231728E0001; Fri, 25 Sep 2020 03:42:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 147B9900002; Fri, 25 Sep 2020 03:42:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 0012B8E0001 for ; Fri, 25 Sep 2020 03:42:19 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B46A1364A for ; Fri, 25 Sep 2020 07:42:19 +0000 (UTC) X-FDA: 77300790798.12.month84_410f2f627165 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 8F0891801BE2F for ; Fri, 25 Sep 2020 07:42:19 +0000 (UTC) X-HE-Tag: month84_410f2f627165 X-Filterd-Recvd-Size: 3615 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 07:42:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601019738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7BQlMTVpid3w3QPZKwJATozfaaStywpOD0hUm7BMi7w=; b=nhIX67r5/rELApLrXgmEzDHEE31IeqwoSpkckAIEk8UEIEr6ZMIX49fwkQ48IylFc9z9TK EZpC7jRUOSEpLammLacEIukHOVSyxHQMkuNsY6JpMhwUjaBbot/vspagWFuzViKybVSPnH cVbLQ9pouPs/lsMrnmS3fbYnMVrMSkU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D4C46ABC4; Fri, 25 Sep 2020 07:42:17 +0000 (UTC) Date: Fri, 25 Sep 2020 09:42:15 +0200 From: Michal Hocko To: Vijay Balakrishna Cc: Andrew Morton , "Kirill A. Shutemov" , Oleg Nesterov , Song Liu , Andrea Arcangeli , Pavel Tatashin , Allen Pais , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [v3 1/2] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged Message-ID: <20200925074215.GA3389@dhcp22.suse.cz> References: <1600305709-2319-1-git-send-email-vijayb@linux.microsoft.com> <1600305709-2319-2-git-send-email-vijayb@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1600305709-2319-2-git-send-email-vijayb@linux.microsoft.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > Cc: stable@vger.kernel.org > Reviewed-by: Pavel Tatashin 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 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. -- Michal Hocko SUSE Labs