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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 D374EC433E1 for ; Tue, 18 Aug 2020 13:50:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 90C1C206DA for ; Tue, 18 Aug 2020 13:50:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="gFo2tdrj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90C1C206DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1755E8D0007; Tue, 18 Aug 2020 09:50:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 127B48D0001; Tue, 18 Aug 2020 09:50:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 015488D0007; Tue, 18 Aug 2020 09:50:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id E108B8D0001 for ; Tue, 18 Aug 2020 09:50:14 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A6FC91EF2 for ; Tue, 18 Aug 2020 13:50:14 +0000 (UTC) X-FDA: 77163823548.11.food31_5503bae2701f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 771C2180F8B82 for ; Tue, 18 Aug 2020 13:50:14 +0000 (UTC) X-HE-Tag: food31_5503bae2701f X-Filterd-Recvd-Size: 5271 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 13:50:13 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id e5so15106275qth.5 for ; Tue, 18 Aug 2020 06:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=i3gzOAPUdUUgkW+MfJiRBZzylD1SwKDup35ranLTE+8=; b=gFo2tdrjm1qkUJWuDiFskzbeO0w5LJx6dyzsZOPwPfOmHDSXzdBGEcXIwDX7whrNV9 JEgVlPiTxZyMBirBuYCHGck9cYWCBQmt5ny0jayeNQ6gfZp4LNLHaLYVZRHrSHKeUY6e uRSpvrjdgx5mqhJbaHjlzb+ptaePm6k7omgqsuP3hL/1RmdPdVTPoALIZZdr5eyJ54WL dsftHxbUTIR9tXIDvqG8jN4H2/lH+Rf1hR50Z0vtfC6A7sLoLgtiM/v15If1BpTZRwDI SAX24oCanz2Ny6U8qxDU6UGtpXs/jD/FGeqLm7SIrw5GSVnzTYUHBo7UfMACrG1lFPPe a1mA== 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=i3gzOAPUdUUgkW+MfJiRBZzylD1SwKDup35ranLTE+8=; b=FiQc8r3uMtKxPJ6LD9sAi8I681SEODzNHuPyCx5eHMzBX4cm9ZHKpDmSJbLSTOwG5q 7E31/Arxwm9Pk3hY1zTwg37rcDHqAz9xNhdVzqG/G+NC/MjsiMWuLeqitABFv+dny62Q y2mUxaUYsFNQdy6syFSHkUiVNyvFdQiwpJt0LGXxMCIKEO8qJ40R49z4cgeEWHcr8qma qZMOilM5AsU376NqFvvsFvYOSpRwvcZkTm0JmVjDuqlfmLP5QQ5MOpZMW8p06G/Aa0Vc KwjW1+FVuSs+422dfgxLVHv1bkUhg3ED38a7/As5RDKhWfq8hhIGXu2VIpNM7gx4quFg Y7qQ== X-Gm-Message-State: AOAM532+i2U8XGJ20bt/STs8WqUJUIgC5A4aJEjXgQfC008flkkYrGW8 mgIf3mM0U0OuKupLbaOaEwMG3Q== X-Google-Smtp-Source: ABdhPJw0MsM7i8bwRZrEdghN116s3dEIEMDqeIJ6VBf7FQiar70mWUPczCEi3eXDG6n3hDEhYsCK4w== X-Received: by 2002:ac8:368f:: with SMTP id a15mr18218469qtc.288.1597758612969; Tue, 18 Aug 2020 06:50:12 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:8b3]) by smtp.gmail.com with ESMTPSA id n15sm20639882qkk.28.2020.08.18.06.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 06:50:11 -0700 (PDT) Date: Tue, 18 Aug 2020 09:49:00 -0400 From: Johannes Weiner To: peterz@infradead.org Cc: Michal Hocko , Waiman Long , Andrew Morton , Vladimir Davydov , Jonathan Corbet , Alexey Dobriyan , Ingo Molnar , Juri Lelli , Vincent Guittot , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 0/8] memcg: Enable fine-grained per process memory control Message-ID: <20200818134900.GA829964@cmpxchg.org> References: <20200817140831.30260-1-longman@redhat.com> <20200818091453.GL2674@hirez.programming.kicks-ass.net> <20200818092617.GN28270@dhcp22.suse.cz> <20200818095910.GM2674@hirez.programming.kicks-ass.net> <20200818100516.GO28270@dhcp22.suse.cz> <20200818101844.GO2674@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200818101844.GO2674@hirez.programming.kicks-ass.net> X-Rspamd-Queue-Id: 771C2180F8B82 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: On Tue, Aug 18, 2020 at 12:18:44PM +0200, peterz@infradead.org wrote: > What you need is a feeback loop against the rate of freeing pages, and > when you near the saturation point, the allocation rate should exactly > match the freeing rate. IO throttling solves a slightly different problem. IO occurs in parallel to the workload's execution stream, and you're trying to take the workload from dirtying at CPU speed to rate match to the independent IO stream. With memory allocations, though, freeing happens from inside the execution stream of the workload. If you throttle allocations, you're most likely throttling the freeing rate as well. And you'll slow down reclaim scanning by the same amount as the page references, so it's not making reclaim more successful either. The alloc/use/free (im)balance is an inherent property of the workload, regardless of the speed you're executing it at. So the goal here is different. We're not trying to pace the workload into some form of sustainability. Rather, it's for OOM handling. When we detect the workload's alloc/use/free pattern is unsustainable given available memory, we slow it down just enough to allow userspace to implement OOM policy and job priorities (on containerized hosts these tend to be too complex to express in the kernel's oom scoring system). The exponential curve makes it look like we're trying to do some type of feedback system, but it's really only to let minor infractions pass and throttle unsustainable expansion ruthlessly. Drop-behind reclaim can be a bit bumpy because we batch on the allocation side as well as on the reclaim side, hence the fuzz factor there.