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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 B4125C432BE for ; Mon, 23 Aug 2021 17:47:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0F8596126A for ; Mon, 23 Aug 2021 17:47:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0F8596126A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7DE366B006C; Mon, 23 Aug 2021 13:47:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78E1A6B0072; Mon, 23 Aug 2021 13:47:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 655F98D0001; Mon, 23 Aug 2021 13:47:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 49AF56B006C for ; Mon, 23 Aug 2021 13:47:04 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DDC39256E1 for ; Mon, 23 Aug 2021 17:47:03 +0000 (UTC) X-FDA: 78507076326.24.43E7410 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf08.hostedemail.com (Postfix) with ESMTP id 7779830000AB for ; Mon, 23 Aug 2021 17:47:03 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id ay33so8585368qkb.10 for ; Mon, 23 Aug 2021 10:47:03 -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:content-transfer-encoding:in-reply-to; bh=gbkRpn8OvHDvVhkug5/SCecw4iR6zEDgQeKV01fnIoo=; b=upkSxN2nnvY2Wv/MwUo3Qk+bN9RsxVHHPTcUHGhtMHImyRfryeKTsloFifEFrqdlt0 UxVtQai+tAQNcsIJ818me8Yhi3/bMHiaU7UglvqElSdxuOBTPg8BCOnN3T1AJfORwqcH NYTKsEACcfB06lkK8E4ps1ukwzCLeG8yfT85LndESHBE7pMmxUCgd78URSV2DpFKMKNs 5j1L94LSJYWhTz1Yyq8X6ZJU0F/PJxu6jlgN3V1E7rR727XeyxqXOvVGAY1aVcOmGrAW 7SpfwdKSRYCa67kYAD3SULGslNCC8EhJZcPuSsdvmwK1YPuq5Us1QyWndADVs8b5Lf83 KDZQ== 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:content-transfer-encoding :in-reply-to; bh=gbkRpn8OvHDvVhkug5/SCecw4iR6zEDgQeKV01fnIoo=; b=QjVgtRfbd+UecEnWUqPQxtWA0GnvFPCnInldPBW2DsdNtysdEHiywpovHQoTSeK6ac W/K7HOPy72dvda4ZnPomgCLp5JZsf6RPGSonzmqbv3aT8fJwGXgCIrtf2UchIqVfffnz 3azDpNAs/2AvRQXK3UEtzmdOq0Us671IwQsXr5z5hqHDBW5RW+ATkhxwuVtEDbYH53aE A83HBu3KI/+XPZ9Rdm39UrV7utzWkous0DSJz2HtDEVesZL9NTzjzcHEudoJlFqoz5sf Sy8cHhdUdfRgK+1AwWZIHsLf1UKPkniNCcTR1TtaicTIaVyrxd0RUCfgDErGstDrgL39 W9Vg== X-Gm-Message-State: AOAM531U1Lr+DUT+mGSqv56NDUJEtEafvm8vY/Wnb2B1nNkOyx0KQRnb 4TmJmQjQLiysf8zwK58Hm8PUdg== X-Google-Smtp-Source: ABdhPJy4VFl7V2wM8ld39ppY0iGYe5/g3eWo45c2toz0PzW8foCKoU6B6OX1uvt8ckaX5+Gqtj2lpA== X-Received: by 2002:a05:620a:41:: with SMTP id t1mr17734902qkt.77.1629740822738; Mon, 23 Aug 2021 10:47:02 -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 s28sm8833950qkm.43.2021.08.23.10.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 10:47:01 -0700 (PDT) Date: Mon, 23 Aug 2021 13:48:43 -0400 From: Johannes Weiner To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: Andrew Morton , Leon Yang , Chris Down , Roman Gushchin , Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim Message-ID: References: <20210817180506.220056-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 7779830000AB Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=upkSxN2n; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf08.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Rspamd-Server: rspam01 X-Stat-Signature: 6nzjfjcsr3mksxysnecdwbod1axh5zfe X-HE-Tag: 1629740823-900394 Content-Transfer-Encoding: quoted-printable 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: Hi Michal, On Mon, Aug 23, 2021 at 06:09:29PM +0200, Michal Koutn=FD wrote: > Hello >=20 > (and sorry for a belated reply). It's never too late, thanks for taking a look. > On Tue, Aug 17, 2021 at 02:05:06PM -0400, Johannes Weiner wrote: > > @@ -2576,6 +2578,15 @@ static void get_scan_count(struct lruvec *lruv= ec, struct scan_control *sc, > > [...] > > + /* memory.low scaling, make sure we retry before OOM */ > > + if (!sc->memcg_low_reclaim && low > min) { > > + protection =3D low; > > + sc->memcg_low_skipped =3D 1; >=20 > IIUC, this won't result in memory.events:low increment although the > effect is similar (breaching (partial) memory.low protection) and signa= l > to the user is comparable (overcommited memory.low). Good observation. I think you're right, we should probably count such partial breaches as LOW events as well. Note that this isn't new behavior. My patch merely moved this part from mem_cgroup_protection(): - if (in_low_reclaim) - return READ_ONCE(memcg->memory.emin); Even before, if we retried due to just one (possibly insignificant) cgroup below low, we'd ignore proportional reclaim and partially breach ALL protected cgroups, while only counting a low event for the one group that is usage < low. > Admittedly, this patch's behavior adheres to the current documentation > (Documentation/admin-guide/cgroup-v2.rst): >=20 > > The number of times the cgroup is reclaimed due to high memory > > pressure even though its usage is under the low boundary, >=20 > however, that definition might not be what the useful indicator would > be now. > Is it worth including these partial breaches into memory.events:low? I think it is. How about: "The number of times the cgroup's memory.low-protected memory was reclaimed in order to avoid OOM during high memory pressure." And adding a MEMCG_LOW event to partial breaches. BTW, the comment block above this code is also out-of-date, because it says we're honoring memory.low on the retries, but that's not the case. I'll prepare a follow-up patch for these 3 things as well as the more verbose comment that Michal Hocko asked for on the retry logic.