Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp596613pxk; Thu, 17 Sep 2020 10:54:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvu7aM13qopJN24mlyUeOXI5kg+jvpaeE7ZtqFyMdkmxXCoPAENcEcYTAMSZgHKtM9bSJS X-Received: by 2002:a17:906:b285:: with SMTP id q5mr31699271ejz.545.1600365262463; Thu, 17 Sep 2020 10:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600365262; cv=none; d=google.com; s=arc-20160816; b=nDXSJtv+z9ODhG61bB+jjd9+xzw5q1EVx8m5uuxhfibOPNXh0oOm7cht8GCgVpt/oS UbhASosyXFfXqRYSvRoHlwoeui0wxltkQOEIn2sJTtmWxXRP/Hf+a7tNICrrFkPVRJHJ AiBTe/JIP1+k/UdaEYsDq5WzV3PnirVSMuD30feWAASD/uBbmitlLL5cjHZxI2ksrGqt b7LNDJJrB3J679Jw8gilOpVqG+0L3Ea2zSAEb3e8Nnw7Bco49mSQbqTfT/+mwRIODwj1 aa5yVKtuJ+3RiPXR8s6NPA5nfHtdwAi6G93rvM004WryemkMeN2Hl0xQ0kt+3km97tep a5qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7ACZ1i9L0eM7pFjFd6XaMh+LP19pdesYPnrbce9bvdE=; b=FVGdNYmnBPnrX/caviX4TsKlg7Vqv8GKib9NKvJNiZUNRF78aOUS2RX1F/CQQyJxv6 mAWDUNeeVnNjhDoTPLbLUoK/fGOISKsLUa6r3opTyXTEVsOECTXzWON9jwC8kUfgbr9H tC1Ub7DPQs7Sv8fsZ+HtR0/s4W93yVXlmvPnT32f/zlL70Qfb4dik2vmG5aoDT/8oA6s 5MeakIgF1GWPYeRF51+KeKNa0eVOnt5S5+nT4cP8isa+kXSe8PwwRRhrux4mfWJpj09C pg1sMhs7vOBmuMFj7W6qDaWv3OPnupAl11eYWuw2Jshr5tQzSLBNL9FcBQAQg9k5Fmau cnUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@suse.com header.s=cantorsusede header.b=m9qgQiSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch15si475642ejb.52.2020.09.17.10.53.59; Thu, 17 Sep 2020 10:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@suse.com header.s=cantorsusede header.b=m9qgQiSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgIQRwo (ORCPT + 99 others); Thu, 17 Sep 2020 13:52:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:34268 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbgIQRwY (ORCPT ); Thu, 17 Sep 2020 13:52:24 -0400 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=cantorsusede; t=1600365141; 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=7ACZ1i9L0eM7pFjFd6XaMh+LP19pdesYPnrbce9bvdE=; b=m9qgQiSVGElQlgS9Y1bmW4eQ8wF71jXeVpuMDzMUgwElV7P1mbCwz/Zv/UkQGU9Q0wpoUk O9BwIm4LqU4fpPS20ikdrS6Z3FNw0MALD5/aJkkPfSxSyM2DPL+8v18XO9O1uy9STJDw7W SmroQcsO1DBGXMthvakPKGk8BQimldnSyHzyXKsAPdspi96E2kWUsLTGIQOBOBi/9Em76k T/+UL+topOL0WxGchvg7SIQi3D49aiZiPWhZedfJfqFFqJJSrdwPwbiq9SnTy3+/O7SjIV dvSBzs/ORRMDWWa5zipmgYvF8xU+YoLJswYD4KVt9DV6r/lVuzgUjI/Q7rZMXA== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id ACFF4B0BE; Thu, 17 Sep 2020 17:52:54 +0000 (UTC) Date: Thu, 17 Sep 2020 19:52:17 +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: [v4] mm: khugepaged: avoid overriding min_free_kbytes set by user Message-ID: <20200917175217.GD29887@dhcp22.suse.cz> References: <1600324779-6782-1-git-send-email-vijayb@linux.microsoft.com> <20200917092805.GA29887@dhcp22.suse.cz> <21c4788c-2516-2e47-5885-486c352c2b6e@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21c4788c-2516-2e47-5885-486c352c2b6e@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 17-09-20 10:27:16, Vijay Balakrishna wrote: > > > On 9/17/2020 2:28 AM, Michal Hocko wrote: > > On Wed 16-09-20 23:39:39, Vijay Balakrishna wrote: > > > set_recommended_min_free_kbytes need to honor min_free_kbytes set by the > > > user. Post start-of-day THP enable or memory hotplug operations can > > > lose user specified min_free_kbytes, in particular when it is higher than > > > calculated recommended value. > > > > I was about to recommend a more detailed explanation when I have > > realized that this patch is not really needed after all. Unless I am > > missing something. > > > > init_per_zone_wmark_min ignores the newly calculated min_free_kbytes if > > it is lower than user_min_free_kbytes. So calculated min_free_kbytes >= > > user_min_free_kbytes. > > > > Except for value clamping when the value is reduced and this likely > > needs fixing. But set_recommended_min_free_kbytes should be fine. > > > > IIUC, after start-of-day if a user performs > - THP disable > - modifies min_free_bytes > - THP enable > above sequence currently wouldn't result in calling init_per_zone_wmark_min. I will not, but why do you think this matters? All we should care about is that auto-tuning shouldn't reduce user provided value [1] and that the memory hotplug should be consistent with the boot time heuristic. init_per_zone_wmark_min should make sure that the user value is not reduced and thp heuristic makes sure it will not reduce this value. So the property should be transitive with the existing code (modulo the problem I have highlighted). [1] one could argue that it shouldn't even increase the value strictly speaking because an admin might have a very good reason to decrease the value but this has never been the semantic and changing it now might be problematic -- Michal Hocko SUSE Labs