Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp271441pxk; Thu, 17 Sep 2020 02:38:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3oNq/FH3GasoxX0biJMQPGObHOdGcUFIzCcR8B2VCtgNawyT/gTJ89b0iO5rVmJi7VDz X-Received: by 2002:a05:6402:1d93:: with SMTP id dk19mr32314285edb.198.1600335483065; Thu, 17 Sep 2020 02:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600335483; cv=none; d=google.com; s=arc-20160816; b=OIYGVDIGUPz7fK+8R5PB6xzvvD/ax6aCRQ2vZ8tUqgx9pW6KBsUncajqDYyxq8uIF0 P6eQwtcODnuamXi5kMCZWIvcjRFYE6aPsib5usOhVcUQqO0cFRKmIaEtIZIUMhIj4MrI AbnwM140mLBwgM+YIm7Mb9DnDaELBk4uuwH9zpSF4TdkU4AcM241BHfhpYrgHKs5Ol98 PFzBUI6oDhqp5DYLK4WrzgJQRgGSbLCe6P0lTX/6VbnVsddVrRLpNVjTwtwsFx0GOOPd 14rh0O7k6eNnnVEr0cuHTdCFWnwu0Qm272+OWUN9htFUL5saim3ccOo6OPeYBs6ZhAJD xFug== 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=YUIHjUHj2KNUMPbEwkFTOw+UMqfbAFdHA56mSK8V/WA=; b=pbLDhHXwuhQFg8v4TLmc/YBYJM7rr+z0WsC76D4dKaTLtk4I0sQ9tKKHttUFUkAuAP QqWb/RsMtxFdCZAZZDBXFgExcWGLgsNu+ikd3uzUwrdSHHFja4gc+BFET0H/+fZ7HRg7 sfXQn5JKTMSj2fH0iYLev4IFpnCMPA+BmFxgobGWLdcQQsqRQugymfUfl1kbd+TzsWaM iE2lzzdMLi/d103YPRegplZ0VCaVfKwUZoVCLu7frdbHGgpHPP6qBu+g3hIVyCQrJy3W fb/jOtxOY0Rkg90EMVJWtaw7GR4lTrSSvHAB1rzkwfrR1hAb9K/T9QI58n5EeoDZW2oe eMAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@suse.com header.s=cantorsusede header.b=uEt0Q+3D; 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 n24si13778602eji.99.2020.09.17.02.37.39; Thu, 17 Sep 2020 02:38:03 -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=uEt0Q+3D; 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 S1726433AbgIQJe2 (ORCPT + 99 others); Thu, 17 Sep 2020 05:34:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:45390 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbgIQJeQ (ORCPT ); Thu, 17 Sep 2020 05:34:16 -0400 X-Greylist: delayed 369 seconds by postgrey-1.27 at vger.kernel.org; Thu, 17 Sep 2020 05:34:15 EDT 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=1600335254; 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=YUIHjUHj2KNUMPbEwkFTOw+UMqfbAFdHA56mSK8V/WA=; b=uEt0Q+3D/ug0xpI+hk1Rr30foykGdOQy7JITrXnwaNZVcatK2gxFBDdUzrdN+lupywFO6j R+fVsrvCkTB0Vj9Xx1h5TA1tMQrWGFTTidjqxCq3EKF4nHld3MpbKlSawzIXxrOgb0/0sK W76fkM9cI19wrDGUU0WKHx8fBda9CPOYiIgIYeNx+0XwbdEeOQRT6K/nYrOHu9AWgdp+DK B9z3NfJGC6F0LBm8gRJcGPlTVP7jiSMGhCErIToLZnUEKEMSLYAAr96Q6CU70o2Ud93fip GSWT1pnAxDoo9mS1DdhDarSTsKeKlAaqu0vYsyRmK+yqEn6MFleb0Qh1JuczIg== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 51802B13B; Thu, 17 Sep 2020 09:34:48 +0000 (UTC) Date: Thu, 17 Sep 2020 11:34:13 +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: <20200917093413.GB29887@dhcp22.suse.cz> References: <1600324779-6782-1-git-send-email-vijayb@linux.microsoft.com> <20200917092805.GA29887@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917092805.GA29887@dhcp22.suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 17-09-20 11:28:06, 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. Something like diff --git a/mm/page_alloc.c b/mm/page_alloc.c index fab5e97dc9ca..69731b19d9bf 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7875,9 +7875,9 @@ int __meminit init_per_zone_wmark_min(void) if (new_min_free_kbytes > user_min_free_kbytes) { min_free_kbytes = new_min_free_kbytes; if (min_free_kbytes < 128) - min_free_kbytes = 128; + min_free_kbytes = max(128, user_min_free_kbytes); if (min_free_kbytes > 262144) - min_free_kbytes = 262144; + min_free_kbytes = max(262144, user_min_free_kbytes); } else { pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n", new_min_free_kbytes, user_min_free_kbytes); -- Michal Hocko SUSE Labs