Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1939416ybv; Thu, 6 Feb 2020 12:40:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy95xNJqP7qhfq5O19YdMLM+T+utSBMJef/f6rvjm9TThXvY7qaSh7YWo0PHHD8NwSPxYat X-Received: by 2002:a05:6830:1:: with SMTP id c1mr29119496otp.254.1581021657494; Thu, 06 Feb 2020 12:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581021657; cv=none; d=google.com; s=arc-20160816; b=KeUCrZvUCUgsF3RuQgD33OANZv4f69q/yZ3iRofEKNyRIiGdL6J8T3puieeIZGcKhk DvnWfyucx/hBBiDPMQFQ7jjLLN3k7Wby1NALF0f5AHsn4n2KCZP78OEPAOldZWfJGJyn uVbea77jtQb/HWrjmPvq81B77OtBKQVuzNxKRda5qbUoOwmi7oXWIyX9NAC3iSa7um5z YN0tmLa+/1f9bh+3rWHKT1ZQAnDSmGRlEI/9olOhRVRMMItonaycVZtv+rG6VCRLm+B1 OpVO9jv4/qVF/krjEe6orISqTZWUrRumxWkGmHQ9qGJGT0negQN/2nvaEMzx32CYYo4X phgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xG8lrNJrYMqb4GvRMFcP1M+jqGxfiqnS6HqIrpyki6Q=; b=p4pZjxK58xliUniTlvcLzZdOfNQrUgkRp4shJXz+nRKGSfsrwufvK/3LI4GPro1ssr nRo1c61NWNbjOXR6Z0JxBT2/wtghlbMVymfh4ft8lya2wO3gTO2LdmxDJsSJe/VCmtlX rkSUJu6DgwVzLFiYUy2TeAlbTuYiMoOpBYsogeAsnpQ3UaBFoFE4ytZOqbfBKOfWiSMO YgOWfYKi89O0SoUAQ3BZo5MB6vidB6Zy3layQZWwEq2a26t9zxOXPbBqx1aCx0w4cDAG TUHsYbvX/Ah8asxMnUfoBm7QUV8XZHMhYGLInELrYl5ME8/5Idh50tVTSxTApeWda3O3 swPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LK3W4xgy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p144si2640157oic.238.2020.02.06.12.40.44; Thu, 06 Feb 2020 12:40:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LK3W4xgy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727851AbgBFUjw (ORCPT + 99 others); Thu, 6 Feb 2020 15:39:52 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:50158 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbgBFUjv (ORCPT ); Thu, 6 Feb 2020 15:39:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xG8lrNJrYMqb4GvRMFcP1M+jqGxfiqnS6HqIrpyki6Q=; b=LK3W4xgy/df9FCXI4xtAKy9CmO U8K080IP8Tu4enkhPr+fe9U2Bc4T+kBMG8PtMhmq0AhQoDuKiPwJNI5z8xKUem5/6PhrZ/dwr4aTC rTHmmuS/hlAiZ/Nu9Rgkk2o5IfVyrhhKQdnfbv21TBEEhAZtzCUPQ/zlmzxFbO8AD0WJVO7ILAWpz ZdBU2aLlggRfEMXgEBgMCnhiOPUJgpiW5JBS2tsxYGIhao4ovo3YJ4ltIWIgYA4MOtkkPqH8kViPa xVgsNB13HrR/+zqjX2GTlGVCGBCbnPrflLkdRJqwNlbKpO53UXgh7fA1xDgalkrSrhH7rBQ3/eU63 vVoAG7cg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iznw9-0004Fy-Gq; Thu, 06 Feb 2020 20:39:45 +0000 Date: Thu, 6 Feb 2020 12:39:45 -0800 From: Matthew Wilcox To: Mike Kravetz Cc: David Rientjes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Song Liu , "Kirill A.Shutemov" , Mel Gorman , Vlastimil Babka , Andrew Morton Subject: Re: [PATCH] mm: always consider THP when adjusting min_free_kbytes Message-ID: <20200206203945.GZ8731@bombadil.infradead.org> References: <20200204194156.61672-1-mike.kravetz@oracle.com> <8cc18928-0b52-7c2e-fbc6-5952eb9b06ab@oracle.com> <20200204215319.GO8731@bombadil.infradead.org> <2ba63021-d05c-a648-f280-6c751e01adf6@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2ba63021-d05c-a648-f280-6c751e01adf6@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 05, 2020 at 05:36:44PM -0800, Mike Kravetz wrote: > The value of min_free_kbytes is calculated in two routines: > 1) init_per_zone_wmark_min based on available memory > 2) set_recommended_min_free_kbytes may reserve extra space for > THP allocations > > In both of these routines, a user defined min_free_kbytes value will > be overwritten if the value calculated in the code is larger. No message > is logged if the user value is overwritten. > > Change code to never overwrite user defined value. However, do log a > message (once per value) showing the value calculated in code. But what if the user set min_free_kbytes to, say, half of system memory, and then hot-unplugs three quarters of their memory? I think the kernel should protect itself against such foolishness.