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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E7818C55186 for ; Fri, 24 Apr 2020 00:33:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB4BA2071E for ; Fri, 24 Apr 2020 00:33:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OfncXb0O" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB4BA2071E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 524538E0005; Thu, 23 Apr 2020 20:33:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D49C8E0003; Thu, 23 Apr 2020 20:33:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C38E8E0005; Thu, 23 Apr 2020 20:33:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 263718E0003 for ; Thu, 23 Apr 2020 20:33:07 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D2B6F180AD81F for ; Fri, 24 Apr 2020 00:33:06 +0000 (UTC) X-FDA: 76740873972.28.pull06_383ef33392157 X-HE-Tag: pull06_383ef33392157 X-Filterd-Recvd-Size: 4344 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Apr 2020 00:33:06 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id 19so8560979ioz.10 for ; Thu, 23 Apr 2020 17:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dfjeF+d7f9NchHXEWqAz4f/HnH49yqOC4MhXcsnjPaM=; b=OfncXb0O4cVD0cZpQ4jDkPy305BpN2r2P6z9LeO3OvDhYXxKOFHMOU8Pj6qbqSzS14 C40RGwJqenIsNVE/ovN9M7/H6gFqi0mAW3QFYy9HITeS15eCFysYg+bAuQsFdSDsK27f 4j+FVPc8VEU3Yg+AINVLc0oQOaI7dK0ITdVXeUcdJ9XwQjae+keWlGG78BHWuiLeCXA1 NZUJq0on5szHmu8ieY+iiuAg+R+N1SEP8MkqHGbG7BsCnnXiAoKQuV7P0M9FL/GO22kf FXzn784qCA8uzVvHmOSnuoce4fvVutaayvlJ9ZgcxMSF5QxZr+fJ1GDkbPsgI6z32pt5 e6xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dfjeF+d7f9NchHXEWqAz4f/HnH49yqOC4MhXcsnjPaM=; b=U4rm6j/WQfyK0h9iHcY/8BzxM5PGmXicAAtwpQ8I5BsjtfBYJujtcT0sleafGkTHiI DL+fMb8dci0l0cgyZerbAf3XiswNR/uI7ht1lBbapMQTCa7STtUutnHIt2HJyqAxclmD flrDd1bwwPqJsgX1eTYdsGeYhJbIJ3PtYN9VATm1lfmS/9O+ga/XpNbLlcxGelxXoSmm zUm/1QAc1kQZ/as4GY9tT6F7IRmK2xK5sNycbyVcnJzCtfOuT0uNDUW3ngptqdVkyigZ OGiRAe21lgtXDU2sNEmzFQ9GQKsWBm/eMNAOCUngU45e1dmeuJg7Ja9vWFbYPmOeMckj 7i9A== X-Gm-Message-State: AGi0PuZmRAMs5eKikobxyStB8douj93p+rjQziWSEGelCKv0hNbhXSR0 I1grfjXxlf/zTeJ2Ga1jiO4220YJS8QDDjTrwLI= X-Google-Smtp-Source: APiQypLfDBonSXxsZaHM7ln0qSrbXJaSzoysFHIIsK2n0TzON7ibPIEEzZVTXUFpiXq29OXiIaOGzMX2BjgxE+A9n+A= X-Received: by 2002:a5d:9042:: with SMTP id v2mr6150729ioq.81.1587688385872; Thu, 23 Apr 2020 17:33:05 -0700 (PDT) MIME-Version: 1.0 References: <20200423061629.24185-1-laoar.shao@gmail.com> <20200423153323.GA1318256@chrisdown.name> <20200423211319.GC83398@carbon.DHCP.thefacebook.com> In-Reply-To: <20200423211319.GC83398@carbon.DHCP.thefacebook.com> From: Yafang Shao Date: Fri, 24 Apr 2020 08:32:29 +0800 Message-ID: Subject: Re: [PATCH] mm, memcg: fix wrong mem cgroup protection To: Roman Gushchin Cc: Chris Down , Andrew Morton , Michal Hocko , Vladimir Davydov , Linux MM , stable@vger.kernel.org, Johannes Weiner Content-Type: text/plain; charset="UTF-8" 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 24, 2020 at 5:13 AM Roman Gushchin wrote: > > On Thu, Apr 23, 2020 at 04:33:23PM +0100, Chris Down wrote: > > Hi Yafang, > > > > I'm afraid I'm just as confused as Michal was about the intent of this patch. > > > > Can you please be more concise and clear about the practical ramifications > > and demonstrate some pathological behaviour? I really can't visualise what's > > wrong here from your explanation, and if I can't understand it as the person > > who wrote this code, I am not surprised others are also confused :-) > > > > Or maybe Roman can try to explain, since he acked the previous patch? At > > least to me, the emin/elow behaviour seems fairly non-trivial to reason > > about right now. > > Hi Chris! > > So the thing is that emin/elow cached values are shared between global and > targeted (caused by memory.max) reclaim. It's racy by design, but in general > it should work ok, because in the end we'll reclaim or not approximately > the same amount of memory. > > In the case which Yafang described, the emin value calculated in the process > of the global reclaim leads to a slowdown of the targeted reclaim. It's not > a tragedy, but not perfect too. It seems that the proposed patch makes it better, > and as now I don't see any bad consequences. > Thanks for your explanation. Your explanation make the issue more clear. If you don't mind, I will copy some of your comments to improve the commit log. -- Thanks Yafang