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=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL 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 8F234C43461 for ; Thu, 17 Sep 2020 18:16:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 117B1221EE for ; Thu, 17 Sep 2020 18:16:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="ZwSEP0Uu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 117B1221EE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 61A6D6B005D; Thu, 17 Sep 2020 14:16:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CB598E0001; Thu, 17 Sep 2020 14:16:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E0D06B0068; Thu, 17 Sep 2020 14:16:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 37DD26B005D for ; Thu, 17 Sep 2020 14:16:58 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ED28A8249980 for ; Thu, 17 Sep 2020 18:16:57 +0000 (UTC) X-FDA: 77273359674.17.duck21_49062f227124 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id C6EE6180D0181 for ; Thu, 17 Sep 2020 18:16:57 +0000 (UTC) X-HE-Tag: duck21_49062f227124 X-Filterd-Recvd-Size: 4132 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 18:16:57 +0000 (UTC) Received: from [192.168.0.121] (unknown [209.134.121.133]) by linux.microsoft.com (Postfix) with ESMTPSA id 0ED3620B7178; Thu, 17 Sep 2020 11:16:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0ED3620B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1600366616; bh=aDIl4wM5hE79rrnz+XVMQffL9OIKEJzAgQA8di2+W6s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ZwSEP0Uu+KTLcxeavjRrf2vOcMvYvWDpPWU9WhezUGaMNiLf/c7cPfEUfplFNdH0a fGEa7hslYSs/7XR7bPP1ievQu4NYQqCCk6eikWpDZHSEbdWm3bZdirIUD2fJvETBh4 6xlzzMHc3Fq0sMHU8Fwv69wic1n/elxuyZqirVDY= Subject: Re: [v4] mm: khugepaged: avoid overriding min_free_kbytes set by user To: Michal Hocko 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 References: <1600324779-6782-1-git-send-email-vijayb@linux.microsoft.com> <20200917092805.GA29887@dhcp22.suse.cz> <21c4788c-2516-2e47-5885-486c352c2b6e@linux.microsoft.com> <20200917175217.GD29887@dhcp22.suse.cz> From: Vijay Balakrishna Message-ID: Date: Thu, 17 Sep 2020 11:16:55 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200917175217.GD29887@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit 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 9/17/2020 10:52 AM, Michal Hocko wrote: > 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 > I made an attempt to address Kirill A. Shutemov's comment. And incrased min_free_kbytes to see the issue in my testing and attempted a fix. I'm ok leaving as it is. Do not want introduce any changes that may cause regression. Thanks, Vijay