From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Weiner Subject: Re: [PATCH resend] memcg: introduce per-memcg reclaim interface Date: Fri, 1 Apr 2022 17:07:32 -0400 Message-ID: References: <20220331084151.2600229-1-yosryahmed@google.com> Mime-Version: 1.0 Return-path: 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== Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Wei Xu Cc: Yosry Ahmed , Michal Hocko , Shakeel Butt , Andrew Morton , David Rientjes , Tejun Heo , Zefan Li , Roman Gushchin , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux Kernel Mailing List , Linux MM , Jonathan Corbet , Yu Zhao , Dave Hansen , Greg Thelen 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!