From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C814C433E0 for ; Thu, 28 May 2020 21:14:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4EBDA206DF for ; Thu, 28 May 2020 21:14:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="tVtux6su" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EBDA206DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chrisdown.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D6A648001A; Thu, 28 May 2020 17:14:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D1B8880010; Thu, 28 May 2020 17:14:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0B118001A; Thu, 28 May 2020 17:14:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id A5EE980010 for ; Thu, 28 May 2020 17:14:44 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5CBD433C4 for ; Thu, 28 May 2020 21:14:44 +0000 (UTC) X-FDA: 76867382088.28.peace39_466fb04c75333 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 4DC876D67 for ; Thu, 28 May 2020 21:14:44 +0000 (UTC) X-HE-Tag: peace39_466fb04c75333 X-Filterd-Recvd-Size: 4279 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 May 2020 21:14:43 +0000 (UTC) Received: by mail-wr1-f52.google.com with SMTP id s8so822575wrt.9 for ; Thu, 28 May 2020 14:14:43 -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=YwVJx+0Fzsm9wVR3tJtvc0+CwNIIZzPeqYlfGkkYDFdW/UVPaUXe1oWktiIsBodAel zXbIECKdNldDh3vHPJFBNjS9bhmUg2bRjmUqiH6u24PzynfSFF+RYfS+IhVp8yXzZ0Wj GdoLkP71dMRGTNtDsHD4X9E/kEGIICkei1SLQDaoY1i9J4oZIwYSAX7E/8Xp7dhFMSO3 ozrFtoosDRSUIfsdPnSaXDw5gAkI5DjO8j/HTf24njoO/xtYj1+aY1MR9RJwN0rjWENH +qib0rj6frg7kHpdcKgZNLeoXpgAERulmUL522XlB6BNyGeHiCx7hUXeq/SIAnsArBC+ XtKQ== X-Gm-Message-State: AOAM531HI8IxluMTQ2/RN6iMLkK51/uUmbkdNmQPeYh9ucJD2PcrMvtD RbDxU8rwZ8Da6ZtA0C0UU0xLuQ== X-Google-Smtp-Source: ABdhPJy9x8tatjpCo/n0+suEu+dHg+NV6QVGsjjs9Au1vBlu6M/wADBmns2Aje7ULPrXqU9Km8vpNQ== 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) X-Rspamd-Queue-Id: 4DC876D67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.