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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3892C433F5 for ; Fri, 1 Apr 2022 21:07:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8A6C8D0002; Fri, 1 Apr 2022 17:07:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E13A48D0001; Fri, 1 Apr 2022 17:07:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB3928D0002; Fri, 1 Apr 2022 17:07:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id B5C858D0001 for ; Fri, 1 Apr 2022 17:07:45 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6ACD5AA074 for ; Fri, 1 Apr 2022 21:07:35 +0000 (UTC) X-FDA: 79309546470.16.8A89860 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf17.hostedemail.com (Postfix) with ESMTP id B99A140026 for ; Fri, 1 Apr 2022 21:07:34 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id d142so3136509qkc.4 for ; Fri, 01 Apr 2022 14:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xpR1DVaP7IDSimYCmW7Cs0QbhOf/zsDSmwDGGMtRXiE=; b=zjuB4EbQMLgWLd1xXiDq0DRbbEAMjzYTkvWV9FTeHjjdzxMzsgLz9cOT8LX0HL865X LHW2BCUJqmYEEKsG5XwbnSGOutsGN/YQ8gmiu4xTRrIth38kOixfHQZQp2D+gQEy+wAp 5eir0XmdbMQD1DcCDnZSs2bABE+JK2WFkzuk8nyxnHCs0K+BO+55i+IvC4lNtDkq/8Xc /JtKNdUi3TT3IKCk5/e+FXfRTo0pkQIePvF+lwPnyDerrmezPkOlDwgKHH0Jqd1QjqH+ b0Ya2VO3D31C+Q+ZLRx1Nd2EdE4udUMCOl40Onplk0lAqsORuAt13L2dbxATWATht7fU ojpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xpR1DVaP7IDSimYCmW7Cs0QbhOf/zsDSmwDGGMtRXiE=; b=AklWMfQ+wJ+BrQcU8kqGUSsngyVbPViTZoQahlgRzzk3gGOe/8gQLSoXNpKlNFJC/E yVtW7Pza3J7s/qRQvaYPDWuLISLue79LY5j7KWbGyAd6m80IbN9ny313cTyeHfh1pA5p Z0scruSQVfccSpnhkXClB6srpO8VaQCAEIFU+bH0t1BgzwRQYLtXl2mknehX5fraxI/y u+Mm+q0EJ0VPj15GHRzDp+SyoTTlybrpkBySAp4k3+bUioI329lKaiwfcW2HYu1wDehD oxABmnxMkzkIMKlgUuPU4DXkODneHgIBoa6mgrQvJjOmFBAHrXm0c6dcbDVPCkXNdyfm QlCg== X-Gm-Message-State: AOAM531mKbEWA+hHYu+26rc7pOf+f3p6PlbyYBIR3gVy5jVcfX00I2lz 6DleRxSg0fuWC1dhjjqR356Wgg== X-Google-Smtp-Source: ABdhPJyycpf+e5FVb3aWtVmQD7bkM0h2MY5J9KLEotdLnlXB7JnQrhs9Y2zK6E5P8AW1jXU+nDIGQA== X-Received: by 2002:a05:620a:20c2:b0:67d:2fb1:d358 with SMTP id f2-20020a05620a20c200b0067d2fb1d358mr7929343qka.55.1648847253922; Fri, 01 Apr 2022 14:07:33 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id w4-20020a05620a0e8400b0067b1bcd081csm1820620qkm.66.2022.04.01.14.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 14:07:33 -0700 (PDT) Date: Fri, 1 Apr 2022 17:07:32 -0400 From: Johannes Weiner To: Wei Xu Cc: Yosry Ahmed , Michal Hocko , Shakeel Butt , Andrew Morton , David Rientjes , Tejun Heo , Zefan Li , Roman Gushchin , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Linux Kernel Mailing List , Linux MM , Jonathan Corbet , Yu Zhao , Dave Hansen , Greg Thelen Subject: Re: [PATCH resend] memcg: introduce per-memcg reclaim interface Message-ID: References: <20220331084151.2600229-1-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Stat-Signature: ctoptgijjp8mcjbzg3wago77b4m9msyo Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=zjuB4EbQ; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B99A140026 X-HE-Tag: 1648847254-776717 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 Fri, Apr 01, 2022 at 01:14:35PM -0700, Wei Xu wrote: > On Fri, Apr 1, 2022 at 8:22 AM Johannes Weiner wrote: > > On Thu, Mar 31, 2022 at 09:05:15PM -0700, Wei Xu wrote: > > > It is better to return an error code (e.g. -EBUSY) when > > > memory_reclaim() fails to reclaim nr_to_reclaim bytes of memory, > > > except if the cgroup memory usage is already 0. We can also return > > > -EINVAL if nr_to_reclaim is too large (e.g. > limit). > > > > For -EBUSY, are you thinking of a specific usecase where that would > > come in handy? I'm not really opposed to it, but couldn't convince > > myself of the practical benefits of it, either. > > > > Keep in mind that MAX_RECLAIM_RETRIES failed reclaim attempts usually > > constitute an OOM situation: memory.max will issue kills and > > memory.high will begin crippling throttling. In what scenario would > > you want to keep reclaiming a workload that is considered OOM? > > > > Certainly, proactive reclaim that wants to purge only the cold tail of > > the workload wouldn't retry. Meta's version of this patch actually > > does return -EAGAIN on reclaim failure, but the userspace daemon > > doesn't do anything with it, so I didn't bring it up. > > -EAGAIN sounds good, too. Given that the userspace requests to > reclaim a specified number of bytes, I think it is generally better to > tell the userspace whether the request has been successfully > fulfilled. Ideally, it would be even better to return how many bytes > that have been reclaimed, though that is not easy to do through the > cgroup interface. The userspace can choose to ignore the return value > or log a message/update some stats (which Google does) for the > monitoring purpose. Fair enough, thanks for your thoughts. No objection from me!