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=-16.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=ham 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 EBD9BC4363D for ; Wed, 30 Sep 2020 20:47:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9D9420759 for ; Wed, 30 Sep 2020 20:47:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="HbS+w7Q0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730402AbgI3Ur4 (ORCPT ); Wed, 30 Sep 2020 16:47:56 -0400 Received: from linux.microsoft.com ([13.77.154.182]:51274 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgI3Ur4 (ORCPT ); Wed, 30 Sep 2020 16:47:56 -0400 Received: from [192.168.0.121] (unknown [209.134.121.133]) by linux.microsoft.com (Postfix) with ESMTPSA id 1F11120B7178; Wed, 30 Sep 2020 13:47:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1F11120B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1601498875; bh=PVNkh3izsumfD/YQ5rKpitT/cl9kAeWDKyqH2QVj+5k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HbS+w7Q099ye2QEz7Hk9X5hAjuajdACKS2YYb9CsQn5EV/ZkQzYnxISlcn4WNn+xG MCj7W1HZhJ8GDNrBKdgjrYI0KCZG6zIMk1PYFja6pP5MT+UCOUXyUQZ1MiD3WcPEdy 34roj4LAK00aUaaUJ/Bw/+QZ7f3cGC1fpOMrn0rY= Subject: Re: [v5] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged To: Mike Kravetz , Andrew Morton , "Kirill A. Shutemov" , Oleg Nesterov , Song Liu , Andrea Arcangeli , Pavel Tatashin , Michal Hocko , Allen Pais Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1601398153-5517-1-git-send-email-vijayb@linux.microsoft.com> <2a380b84-4fee-fa4e-e862-8a8577961088@oracle.com> From: Vijay Balakrishna Message-ID: <8cdb105c-2b7b-1997-ed82-22f4bb25638c@linux.microsoft.com> Date: Wed, 30 Sep 2020 13:47:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <2a380b84-4fee-fa4e-e862-8a8577961088@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/30/2020 11:20 AM, Mike Kravetz wrote: > On 9/29/20 9:49 AM, Vijay Balakrishna wrote: >> When memory is hotplug added or removed the min_free_kbytes should 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 >> Acked-by: Michal Hocko > > Sorry for jumping in so late. Should we use this as an opportunity to > also fix up the messages logged when (re)calculating mfk? They are wrong > and could be quite confusing. Sure. Please share your thoughts regarding appropriate message. Here is what I'm thinking pr_warn("min_free_kbytes is not updated to %d because current value %d is preferred\n", new_min_free_kbytes, min_free_kbytes); If above message is reasonable I can post a new revision (v6). Thanks, Vijay > For example consider the following sequence > of operations and corresponding log messages produced. > > Freshly booted VM with 2 nodes and 8GB memory: > # cat /proc/sys/vm/min_free_kbytes > 90112 > # echo 90000 > /proc/sys/vm/min_free_kbytes > # cat /proc/sys/vm/min_free_kbytes > 90000 > # echo 0 > /sys/devices/system/node/node1/memory56/online > [ 135.099947] Offlined Pages 32768 > [ 135.102362] min_free_kbytes is not updated to 11241 because user defined value 90000 is preferred > [ 135.109070] khugepaged: raising min_free_kbytes from 90000 to 90112 to help t > ransparent hugepage allocations > # cat /proc/sys/vm/min_free_kbytes > 90112 > # echo 1 > /sys/devices/system/node/node1/memory56/online > [ 231.656075] min_free_kbytes is not updated to 11334 because user defined value 90000 is preferred > # cat /proc/sys/vm/min_free_kbytes > 90112 >