Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp406070ybm; Fri, 29 May 2020 03:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxILrGHE29dDVnzRT+XCnmbvbZMimpr9cJTkX7zPrRE40maqqp+RnEVmMJRT+AvKEFMoSQP X-Received: by 2002:a05:6402:1775:: with SMTP id da21mr7681883edb.271.1590747089302; Fri, 29 May 2020 03:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590747089; cv=none; d=google.com; s=arc-20160816; b=LJygiUNnlsiPzWH3mjVpvVEWgCH+yYrhVSlTeX8Q2M5or7ZsAPEKp2d5gIyfwDBOVd va844hD5sjEIjKDi+L2aIqlMcpqGk3tNIZ7VI+uc5sF6x1P4VKfQVEjW7KDv7NP5vUxu Mc74GsBUaDkeBZDcOdKAErxttzWo6fAtgMicE5QmFh5aujyaPFacuA0Y4YD3khkcKVTe 3XPBVgwXllkIHdFmfKMH14IQpABc7xh3MSPeKNPx0RiCBWT4Fbb9n1Fl9QVNtuftUxgw bs1nFp/v8DnC0Qc5HBzeL8n/LoDJRt17TRDJxN+on70KGuet67UoNFKZSEfyCqURJoeq Revg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EGCTr//CJ/0Q2eA0EeEmXyU8B15617Zs/uV0IexoscQ=; b=lvrapUhk8WdtgYCEb+RZf3fF4tB/7UdoojAmeltCScwsl6JmsNDWzoiDmhwgpebfHz oo8V1eB+V03PA4eCL9wFr8bOyAhuMf9AAQSpN20OpDPQFBlvOalJ1zwpYwkvo4TJEfNP L/k2f13FaqFPi+jrOudNLbCOUhy2FVPkanRAY8A092WPgS/5DUMVhXUgcnPlZ0KBo88E GLynbF41jblFgW14Cyy65HacL0HWuYGUSfdRPE7hC605pnDRNwFvwZQilvNiHThrUS4O N3IQjl4d9/ZA0Y6xHBRhpJMWLdGgmzAZpMyn7t+av9weJsAAGwckj96XLpZH3FmR9Qus PJvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=Y11uIhOm; 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 w19si88728edt.402.2020.05.29.03.11.05; Fri, 29 May 2020 03:11:29 -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=Y11uIhOm; 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 S1726086AbgE2KJA (ORCPT + 99 others); Fri, 29 May 2020 06:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725681AbgE2KJA (ORCPT ); Fri, 29 May 2020 06:09:00 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6ADC03E969 for ; Fri, 29 May 2020 03:08:59 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id t18so2869312wru.6 for ; Fri, 29 May 2020 03:08:59 -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:user-agent; bh=EGCTr//CJ/0Q2eA0EeEmXyU8B15617Zs/uV0IexoscQ=; b=Y11uIhOmRXyo7ieDj5COXVZGcR2zPt8sa+tZoxdWPwOhh82K5aMgVHdKX8MwCKQog6 R5xkeI26afEweBp7Mx7N7MkVhsgf+2kKhl8P2I8yKYZyAHWvoHSt/vK1imWNu4m3iKGH pOwGMBJuSK1v0vztOth0Idw9xsAZeoIm1s9KQ= 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:user-agent; bh=EGCTr//CJ/0Q2eA0EeEmXyU8B15617Zs/uV0IexoscQ=; b=U1iYa22nRLgQ+snv9PACZtgiRVcUXTFPl/gd62JEFulOsYi7oiw3WS34qpMfvXbgUF 0Wyh1jy059QPUD1zbjz9xnhGbt/4wRTDXAO4GecYWWrpRFT9lRERjZ8Ou7umaQs2bhsh nqHl+Oj9yqBAN9biHh9Hven7WYbDBzzp8q5f8Wv75f22AZnaBpwAt4KinDyqOZJI0bI+ HQhXl16g6MWBd3HloOKvC56XmmsurbUgpAY2G/EdY5lZaEF5nvopdjPZ5yFsiQDrH3F+ Y0ew1kNSGUuE3dfINbTG+th65qodZ7MKjUhfItEMyGonpskVPbWFpxMDuWBzGnFwRM/e A21g== X-Gm-Message-State: AOAM532oWWa56l0ioCMpfygNAQKv5SOQ6lLh/JiW/I9iT+8cYWBlAC8n YvqvtFfZmnAcJucpGbDnW23Hyw== X-Received: by 2002:a5d:498b:: with SMTP id r11mr5190933wrq.328.1590746938609; Fri, 29 May 2020 03:08:58 -0700 (PDT) Received: from localhost ([2a01:4b00:8432:8a00:56e1:adff:fe3f:49ed]) by smtp.gmail.com with ESMTPSA id z12sm10088964wrg.9.2020.05.29.03.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 03:08:58 -0700 (PDT) Date: Fri, 29 May 2020 11:08:58 +0100 From: Chris Down To: Michal Hocko Cc: Johannes Weiner , Andrew Morton , 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: <20200529100858.GA98458@chrisdown.name> References: <20200520175135.GA793901@cmpxchg.org> <20200521073245.GI6462@dhcp22.suse.cz> <20200521135152.GA810429@cmpxchg.org> <20200521143515.GU6462@dhcp22.suse.cz> <20200521163833.GA813446@cmpxchg.org> <20200521173701.GX6462@dhcp22.suse.cz> <20200521184505.GA815980@cmpxchg.org> <20200528163101.GJ27484@dhcp22.suse.cz> <20200528164848.GB839178@chrisdown.name> <20200529073118.GE4406@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200529073118.GE4406@dhcp22.suse.cz> User-Agent: Mutt/1.14.2 (2020-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal Hocko writes: >> > > task->memcg_nr_pages_over_high is not vague, it's a best-effort >> > > mechanism to distribute fairness. It's the current task's share of the >> > > cgroup's overage, and it allows us in the majority of situations to >> > > distribute reclaim work and sleeps in proportion to how much the task >> > > is actually at fault. >> > >> > Agreed. But this stops being the case as soon as the reclaim target has >> > been reached and new reclaim attempts are enforced because the memcg is >> > still above the high limit. Because then you have a completely different >> > reclaim target - get down to the limit. This would be especially visible >> > with a large memcg_nr_pages_over_high which could even lead to an over >> > reclaim. >> >> We actually over reclaim even before this patch -- this patch doesn't bring >> much new in that regard. >> >> Tracing try_to_free_pages for a cgroup at the memory.high threshold shows >> that before this change, we sometimes even reclaim on the order of twice the >> number of pages requested. For example, I see cases where we requested 1000 >> pages to be reclaimed, but end up reclaiming 2000 in a single reclaim >> attempt. > >This is interesting and worth looking into. I am aware that we can >reclaim potentially much more pages during the icache reclaim and that >there was a heated discussion without any fix merged in the end IIRC. >Do you have any details? Sure, we can look into this more, but let's do it separately from this patch -- I don't see that its merging should be contingent on that discussion :-)