Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1911841imm; Thu, 24 May 2018 02:48:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqpI7RCFTzUUIYniqg9ChO9i/ukZrsz7siEKbLX6WZMSap1F40kDN0QbAyLNdjrl0I9M/Jt X-Received: by 2002:a62:6642:: with SMTP id a63-v6mr6476272pfc.162.1527155308060; Thu, 24 May 2018 02:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155308; cv=none; d=google.com; s=arc-20160816; b=iLoPufZpXeiSYchKHqQ9eh4OcXV03/yN/zWCOHsAMj0X+WbxiGB05l6MPOOYOq2F8M Uy14PvjYYsRMHXQ9eop0UFRMQT6iuwTS0T0y3xa/IV+Bd8+A6cpVFklGKhsIh00se3DO FfLW+RPCn0vMUVQsWT8/oT6ceaQSPwtld0fQZDiX06TL24Dz414jdNpDG6+skzdqhAhK t4KP0FlkehM7CD8vciYQQ3yHYMmEI7vHngcVKvQDk1MCECuN+vxNtvr8DczAPhO/+/21 nz9Ckb3fWEIWTMGA5HItKnGIusyPsVpPqjTZB57eTlXPU2O8g47CbnnlX1lIJmLjq701 6QGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=YKAIRIgSvCHo6vQsBrZbIPMDAgvmzHRfEtc48nADraY=; b=hveJDH0q/9okEYdtx7umZ9Uq0VsvEpuL5Gfrqk/gxc4spmmRdv2qgkDXV/jyHWopmU y0z38M8lSsFL6tHgAhjQsmO3dlAq/yARLi2bqXDQBxeH8rDLMshQ1Gff1U6gXNvVCbAJ 3CFzkT4a3iWRjR+Z3l5kyqO+nJTDAXWsuGwIULzAqDiSo+YvkkLMQtdnl6nP1E81u6BY QxDteirEi37ipBTU8Z8aaM/Q8uXxOJVcbU91XStcy+GaRVsbJUEL87Wbr4p7+RpAGpRw NuOV4+IM4uhIk3BxKTmcy5fuRk52dq7HhNXizxwfAmXaBbHkLv1vhrHVB+dFWnyt9gtb qdeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1hlUX+AH; 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 c11-v6si19690173pll.102.2018.05.24.02.48.13; Thu, 24 May 2018 02:48:28 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=1hlUX+AH; 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 S966910AbeEXJqW (ORCPT + 99 others); Thu, 24 May 2018 05:46:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:57392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966482AbeEXJqN (ORCPT ); Thu, 24 May 2018 05:46:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AA3A208BA; Thu, 24 May 2018 09:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155172; bh=X+mtLcHtgq64qSb+ojiSw0ykYVrvoTTY0r3AJ1V+eoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1hlUX+AHMp4xqlzVNuGIPfESjTHXDTMyPcG+KLGXnlFJwkC50/EX6ekMGI/AoHw51 SMjHsWSaPTYhAmw/fCZAeKa/mPym7GeVSEDbWqE9eNufmfcib0CbNRFPEXBzzUNpGX pv7abb3eZId4+MOgxq+E8LFrxM3CklmJrdpxcKe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Weiner , Rik van Riel , Mel Gorman , Michal Hocko , Andrew Morton , Linus Torvalds Subject: [PATCH 4.4 48/92] proc: meminfo: estimate available memory more conservatively Date: Thu, 24 May 2018 11:38:25 +0200 Message-Id: <20180524093204.135765542@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Weiner commit 84ad5802a33a4964a49b8f7d24d80a214a096b19 upstream. The MemAvailable item in /proc/meminfo is to give users a hint of how much memory is allocatable without causing swapping, so it excludes the zones' low watermarks as unavailable to userspace. However, for a userspace allocation, kswapd will actually reclaim until the free pages hit a combination of the high watermark and the page allocator's lowmem protection that keeps a certain amount of DMA and DMA32 memory from userspace as well. Subtract the full amount we know to be unavailable to userspace from the number of free pages when calculating MemAvailable. Signed-off-by: Johannes Weiner Cc: Rik van Riel Cc: Mel Gorman Acked-by: Michal Hocko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Mel Gorman Signed-off-by: Greg Kroah-Hartman --- fs/proc/meminfo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -57,11 +57,8 @@ static int meminfo_proc_show(struct seq_ /* * Estimate the amount of memory available for userspace allocations, * without causing swapping. - * - * Free memory cannot be taken below the low watermark, before the - * system starts swapping. */ - available = i.freeram - wmark_low; + available = i.freeram - totalreserve_pages; /* * Not all the page cache can be freed, otherwise the system will