Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1461142ybk; Thu, 21 May 2020 07:26:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO1Aa9LnXN7EKhmh0Xzy8z0B514B+pR2RmFPwJUHLnVmHqxjZbfluxyXyjg62qQYAuiM1w X-Received: by 2002:a17:906:86d9:: with SMTP id j25mr3701405ejy.203.1590071179991; Thu, 21 May 2020 07:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590071179; cv=none; d=google.com; s=arc-20160816; b=q05AuYc0YyY1KUFtXnbwHTpvKOkgbGGkX2vdypTE8xHrJAt0U1Y0GKz2WJ30lSIfZa sSCbO6EbmJUf88+0KWDNekQvA8oaj+BNLrPkydvmTkfjM0OyGUn6w0opm7K2GJb09xS1 9D1R2JWf4AMRbijAZb+RPzol5L4bKr1RHZCj3xpnb5DO8G3tLLpV/9A6gaMIsg9zFxkT mOplE0JCLXpE8vz5p1IFJT0WoZNoWkUl88xv+qto8xM1Y2GjMyXkOwzAukw8pfG//629 BRSZvuz8idDmn+lVIWUWTrSn0aEeC2fd9613yvqCp3RymXezwj/tSnPUfXlcg8rwMkSi FQNg== 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=HXVdafa9z18urmVF3KS9w5IeKlLTrJcs4nowtAYCuh4=; b=HdTRVk3gyTe3E5VTlV73UtVebblNEInFreOXLfxTjtWuYW8Hzv5jSwZXlbtMoJbSJd CFkCCQM3s2KBVyHgvfYgsD4xdCFfCw5jErw+pa5ERV8OhwDIPnbj89b8sAy3trupUg4D cKi4HllBi1hZMJlAkbED+M3UGncYnRMU56lWj9MUl/5Kpardv0hczQwe0zRrKotYSqaW ddIuVaYiQxADc9pKF9Bp8x9FHtQLgH2GRmLkkmPpxfGUEpG23bFnaSXxd3kpkt2NwvKO 5y/0aqTZ1OW9pz5GqOMe/mdc5HqiOX4mcn5wFQ2GAtcl5qiYvCz8LADOFgxsLT5WzxGW 5sUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=WUx7EMZX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly12si3292608ejb.623.2020.05.21.07.25.56; Thu, 21 May 2020 07:26:19 -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=pass header.i=@chrisdown.name header.s=google header.b=WUx7EMZX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729778AbgEUOXP (ORCPT + 99 others); Thu, 21 May 2020 10:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729542AbgEUOW3 (ORCPT ); Thu, 21 May 2020 10:22:29 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52B5C061A0E for ; Thu, 21 May 2020 07:22:28 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id i16so6775814edv.1 for ; Thu, 21 May 2020 07:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HXVdafa9z18urmVF3KS9w5IeKlLTrJcs4nowtAYCuh4=; b=WUx7EMZXoTwxert//L8QB2qHfWrZiacoi76OCdMTNyuay8JGMq6fWNmQj0SQnbRFEh WRh1UcI6g53+15lQHxMx26j8V4Gxuc5gDqobeFXzjZDMWfdl3fkdcoRgn0v8vArqtsrt 1Vv1WER8yCs5NkdKv+KCn0M/GlQDXzUtCKOAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HXVdafa9z18urmVF3KS9w5IeKlLTrJcs4nowtAYCuh4=; b=G/0FHrvnq9uiFWs/g/dF04OhTrZjRKqHFdifv19+Ql6xuQTyvr0ZsErAPGkn+/fLzw 8CcYI+DZptNPGg/Jv7c6m5W2Q2xb7q9l0/PrrpTWGqaXrJQDTTtosaDRcyutNOANHXTo eFG36AcXTqScDrfGG2Fi2SqKZ4ijJV9t91SFKCfhbgmouKjSY8O/k4HQSYx/GMY2jV0o 0BmzjGM37/KiQ9l+I03ZHdRLiteRSuWNWh6POpo/faNlGOb/Q8mJN5Ez0K7J6f7gMRbQ bTZvvVjBcukRfb27rQM8q7QD1UfJfDJTtHgPJWrnETPnnj7g4cr5+ZI1k+TmEf4DIh5d Lxew== X-Gm-Message-State: AOAM533O9LeOcdkOSS5/RF9eMpI5kar8G0hlNOVasT0LdQ3L5jfewcwU gCOwVdwyhC2ePyKXQ76LG/mGVQ== X-Received: by 2002:a05:6402:1c0e:: with SMTP id ck14mr8165813edb.356.1590070947093; Thu, 21 May 2020 07:22:27 -0700 (PDT) Received: from localhost ([2620:10d:c093:400::5:4262]) by smtp.gmail.com with ESMTPSA id i2sm4588656edy.30.2020.05.21.07.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 07:22:26 -0700 (PDT) Date: Thu, 21 May 2020 15:22:23 +0100 From: Chris Down To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm, memcg: reclaim more aggressively before high allocator throttling Message-ID: <20200521142223.GG990580@chrisdown.name> References: <20200520202650.GB558281@chrisdown.name> <20200521071929.GH6462@dhcp22.suse.cz> <20200521112711.GA990580@chrisdown.name> <20200521120455.GM6462@dhcp22.suse.cz> <20200521122327.GB990580@chrisdown.name> <20200521123742.GO6462@dhcp22.suse.cz> <20200521125759.GD990580@chrisdown.name> <20200521132120.GR6462@dhcp22.suse.cz> <20200521133324.GF990580@chrisdown.name> <20200521135838.GT6462@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200521135838.GT6462@dhcp22.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal Hocko writes: >On Thu 21-05-20 14:41:47, Chris Down wrote: >> Michal Hocko writes: >> > On Thu 21-05-20 13:57:59, Chris Down wrote: >[...] >> > > If you're talking about reclaim, trying to reason about whether the overage >> > > is the result of some other task in this cgroup or the task that's >> > > allocating right now is something that we already know doesn't work well >> > > (eg. global OOM). >> > >> > I am not sure I follow you here. >> >> Let me rephrase: your statement is that it's not desirable "that some task >> would be throttled unexpectedly too long because of [the activity of another >> task also within that cgroup]" (let me know if that's not what you meant). >> But trying to avoid that requires knowing which activity abstractly >> instigates this entire mess in the first place, which we have nowhere near >> enough context to determine. > >Yeah, if we want to be really precise then you are right, nothing like >that is really feasible for the reclaim. Reclaiming 1 page might be much >more expensive than 100 pages because LRU order doesn't reflect the >cost of the reclaim at all. What, I believe, we want is a best effort, >really. If the reclaim target is somehow bound to the requested amount >of memory then we can at least say that more memory hungry consumers are >reclaiming more. Which is something people can wrap their head around >much easier than a free competition on the reclaim with some hard to >predict losers who do all the work and some lucky ones which just happen >to avoid throttling by a better timing. Really think of the direct >reclaim and how the unfairness suck there. I really don't follow this logic. You're talking about reclaim-induced latency, but the alternative isn't freedom from latency, it's scheduler-induced latency from allocator throttling (and probably of a significantly higher magnitude). And again, that's totally justified if you are part of a cgroup which is significantly above its memory.high -- that's the kind of grouping you sign up for when you put multiple tasks in the same cgroup. The premise of being over memory.high is that everyone in the affected cgroup must do their utmost to reclaim where possible, and if they fail to get below it again, we're going to deschedule them. *That's* what's best-effort about it. The losers aren't hard to predict. It's *all* the tasks in this cgroup if they don't each make their utmost attempt to get the cgroup's memory back under control. Doing more reclaim isn't even in the same magnitude of sucking as getting allocator throttled.