Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp998140img; Fri, 22 Mar 2019 13:13:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhzXaJsrKmiVs9Oguz0ZKoXvrmFkZAPCVWCHWYESTaeez2SvgE+uGrp2WE81RmiZSJu/yH X-Received: by 2002:a63:df12:: with SMTP id u18mr10511490pgg.135.1553285581329; Fri, 22 Mar 2019 13:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553285581; cv=none; d=google.com; s=arc-20160816; b=K4ab4I1U5wb90Jtjq9aH0BPFC/CBahUsu4b+t1CBGl0l+EitCpi5Gv9Bt6GLqHR1cW b/t7zvzmxC+9eg4ckWppfMGllnjMWcVNBXO30ApamaB6ATiCm3optV0/QZLYtaLsfN3l ZimINcBmNf51s23F0tCR7GrOjFZLDbvzrHqLBwBbTLf0+/h4gwo1b8HZM1vglYOLao6o xfBDEY6b/zkTBYRE/+eNfXN4JviU7JU9iao9Vgy3f1DmdSj4Dqr1E7UxWlXRTucAWFt9 InHwPHTOyufgc1hdc1jEQa3no/nYjRES+fCOUF1A+N3gk+iWxUsybLdrUtv9QcHD4PZT aSVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=QV+yml+dmrKhpJsktkz3H/NnictQC4bT/SAT8qS5SQs=; b=Ha6be/OShILSxuVQCqSoKiMBhICFRBBTlB+YRThy6OEa22GRfcXdWhRGQhpc5p5beY M236cTmCi1gzTj+iiHCUPMskbEfcEdfxcaWkvjc/Q81rOqqlyr5p1KyxKpua9STsmfHe 61rjiSooQrLPjGchm0HvttcvtJOFTf49886uhCG3vyqhWWIIUEq2W4yYAg/JdXr3QHGt 86QYrrix4uOeJhYJPBOXqC1ouemfQGZngYYzS68NFAvKqAvdGhoe/YcW8UZCwldAuiI1 b1z0R2/fM23GI+kBNHzqYqLPJr93uw1ofFO3/XZHOQbE0OOeuJayNvPLAovCB6hb558e gQig== ARC-Authentication-Results: i=1; mx.google.com; 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 u6si7181293pgr.456.2019.03.22.13.12.45; Fri, 22 Mar 2019 13:13:01 -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; 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 S1727535AbfCVUKS (ORCPT + 99 others); Fri, 22 Mar 2019 16:10:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46734 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbfCVUKS (ORCPT ); Fri, 22 Mar 2019 16:10:18 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9E62D1BC1; Fri, 22 Mar 2019 20:10:16 +0000 (UTC) Date: Fri, 22 Mar 2019 13:10:15 -0700 From: Andrew Morton To: Chris Down Cc: Johannes Weiner , Michal Hocko , Tejun Heo , Roman Gushchin , Dennis Zhou , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: Re: [PATCH REBASED] mm, memcg: Make scan aggression always exclude protection Message-Id: <20190322131015.05edf9fac014f4cacf10dd2a@linux-foundation.org> In-Reply-To: <20190322160307.GA3316@chrisdown.name> References: <20190228213050.GA28211@chrisdown.name> <20190322160307.GA3316@chrisdown.name> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Mar 2019 16:03:07 +0000 Chris Down wrote: > This patch is an incremental improvement on the existing > memory.{low,min} relative reclaim work to base its scan pressure > calculations on how much protection is available compared to the current > usage, rather than how much the current usage is over some protection > threshold. > > Previously the way that memory.low protection works is that if you are > 50% over a certain baseline, you get 50% of your normal scan pressure. > This is certainly better than the previous cliff-edge behaviour, but it > can be improved even further by always considering memory under the > currently enforced protection threshold to be out of bounds. This means > that we can set relatively low memory.low thresholds for variable or > bursty workloads while still getting a reasonable level of protection, > whereas with the previous version we may still trivially hit the 100% > clamp. The previous 100% clamp is also somewhat arbitrary, whereas this > one is more concretely based on the currently enforced protection > threshold, which is likely easier to reason about. > > There is also a subtle issue with the way that proportional reclaim > worked previously -- it promotes having no memory.low, since it makes > pressure higher during low reclaim. This happens because we base our > scan pressure modulation on how far memory.current is between memory.min > and memory.low, but if memory.low is unset, we only use the overage > method. In most cromulent configurations, this then means that we end up > with *more* pressure than with no memory.low at all when we're in low > reclaim, which is not really very usable or expected. > > With this patch, memory.low and memory.min affect reclaim pressure in a > more understandable and composable way. For example, from a user > standpoint, "protected" memory now remains untouchable from a reclaim > aggression standpoint, and users can also have more confidence that > bursty workloads will still receive some amount of guaranteed > protection. Could you please provide more description of the effect this has upon userspace? Preferably in real-world cases. What problems were being observed and how does this improve things?