Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp751533ybm; Thu, 28 May 2020 14:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD6jO9YahnLqetGqvs/i/R/hMfh2qLEsMt6LZ9wPzs+3dNf1uxVYs81N16WrJjqZZfm2sg X-Received: by 2002:a17:906:8283:: with SMTP id h3mr5295613ejx.415.1590700650255; Thu, 28 May 2020 14:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590700650; cv=none; d=google.com; s=arc-20160816; b=XfwKPVs0Aw1JmHEL1asvw7CVJA4BOaRL1TyfxWbFMk5gg8EcWBU5Q44Mq5MlTSsdlB MHT6GjmkMRPTfYn3QhModEk2CBxptmau3OzNpB0Y+qagGwVSt3+4khNhtMQptuS0Imua MlBnsNKwChqJ9eWtr624J2ZDxQ5BOYKzVKav8/DUdbs2qWsrFWZFhKnIfh1JN2Gw60I6 VAOCVOk+bXgsksWZAzL4UUw02qg9tWGLyC4b+AewXUr7GloSRhdB9d3pFnLpE74j9u6L 6oB8WHfHxlKwwVxd8pClf3reeRx9uCRtAljc3C6ZfSbK8kjQ0bQ7OjngGVvAkX6CEU9U 9yqg== 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=Md5HCLgP2FEvxYLu9x06BehC1qjXovJHaXEUB6IGroo=; b=OpG6Y+Cz8C6GDvhDPi2c2qp67AaGzR/t+lUsWJQFQY2PX5eKNeZaFTTsieV8YsPsR5 UCf3lOuNqIw5BVv1FHwo/EzkYcruepy+uxFq8eesTBAZ3/mzaoJPY1foL+tIF6Gx6eyo PH50m9SD53co8+X9EpBJqSa9+pVB17JRA3esLglBMHeVD5joE1ri22oyTnRlJxN9/+AM H/kQ1pMa+kXhX4v0uqYgl03no+A1uW83jNi6qjkDIdfRP+6Ue6tk0GPwSoIJmJkvh+ql Ha+55p3lXYM1xiadARyJcoTLyoRrlZ6+1jy74lUOhINEJA+luVZTljywJ0dJXtyFI/qi h0eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=tVtux6su; 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 ci9si2110787ejb.218.2020.05.28.14.17.06; Thu, 28 May 2020 14:17:30 -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=tVtux6su; 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 S2407517AbgE1VOr (ORCPT + 99 others); Thu, 28 May 2020 17:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407489AbgE1VOp (ORCPT ); Thu, 28 May 2020 17:14:45 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43C28C08C5C6 for ; Thu, 28 May 2020 14:14:44 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id l10so815959wrr.10 for ; Thu, 28 May 2020 14:14:44 -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=Md5HCLgP2FEvxYLu9x06BehC1qjXovJHaXEUB6IGroo=; b=tVtux6suf22nedoh998nr2nUX5JUphMEZFx1Mo5ltS8yQR6kIabLVyb+3YEpbDz5OG vQXWDGS1o1GyJcdyLG/lH+pz8BSLyVItVBFyS1IDgO033yA5fsTuAysRfzYRrHiwtbxP t9F33VrCQRi12tf3yFgiOPMHjDXOjcKQ8rFW4= 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=Md5HCLgP2FEvxYLu9x06BehC1qjXovJHaXEUB6IGroo=; b=dJMUcI8lfWO5Qc8cCFOUTL7ECoCv/EenZk/L6AyUqwkOnOPLwFtnMngOaCOoZnGpTb GzxTcEuGyMVDeope4IG6xIOoqmNENojf0Wp2deDxD2jqB7fljxmNuGd/WYFoxo9Ek9La bOquYQK1jci76xt9O/mpDPgG5HJHYOoXymFBo0WzuL5lz3U5AD06UpS23DGswsv38/MC Uh4miMKWYXDFuTL0rx8Nx7ItRg6WNe0pQXKQeyBM/6dzDhNU4VOIRUgwKnAtIzTOqC9p WniP3SDiq+cbJI03xeBSJDayCG6Zvi1RmOu8A8usu3GB7Eb1T/ed55CLOvcJHCR92Lfc e94A== X-Gm-Message-State: AOAM532Qj0xqsCoc6OV/y6DuJ89+0NabTdHTHUOTAaqIMxJjwJvRQqTh 34dz21MMN6F2A2YHrD2C6Z9eGLCnS+uCNym+ X-Received: by 2002:adf:ed51:: with SMTP id u17mr4889766wro.285.1590700482631; Thu, 28 May 2020 14:14:42 -0700 (PDT) Received: from localhost ([2a01:4b00:8432:8a00:56e1:adff:fe3f:49ed]) by smtp.gmail.com with ESMTPSA id k26sm8205312wmi.27.2020.05.28.14.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2020 14:14:41 -0700 (PDT) Date: Thu, 28 May 2020 22:14:41 +0100 From: Chris Down To: Johannes Weiner Cc: Shakeel Butt , Andrew Morton , Tejun Heo , Michal Hocko , Linux MM , Cgroups , LKML , Kernel Team Subject: Re: [PATCH] mm, memcg: reclaim more aggressively before high allocator throttling Message-ID: <20200528211441.GA3410@chrisdown.name> References: <20200520143712.GA749486@chrisdown.name> <20200528194831.GA2017@chrisdown.name> <20200528202944.GA76514@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200528202944.GA76514@cmpxchg.org> 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 Johannes Weiner writes: >> I don't feel strongly either way, but current->memcg_nr_pages_over_high can >> be very large for large allocations. >> >> That said, maybe we should just reclaim `max(SWAP_CLUSTER_MAX, current - >> high)` for each loop? I agree that with this design it looks like perhaps we >> don't need it any more. >> >> Johannes, what do you think? > >How about this: > >Reclaim memcg_nr_pages_over_high in the first iteration, then switch >to SWAP_CLUSTER_MAX in the retries. > >This acknowledges that while the page allocator and memory.max reclaim >every time an allocation is made, memory.high is currently batched and >can have larger targets. We want the allocating thread to reclaim at >least the batch size, but beyond that only what's necessary to prevent >premature OOM or failing containment. > >Add a comment stating as much. > >Once we reclaim memory.high synchronously instead of batched, this >exceptional handling is no longer needed and can be deleted again. > >Does that sound reasonable? That sounds good to me, thanks. I'll change that in v2 soonish and update the changelog.