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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 B4094C54FCB for ; Fri, 24 Apr 2020 12:45:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7AC0620706 for ; Fri, 24 Apr 2020 12:45:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IPtI4KQH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AC0620706 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 102DE8E0005; Fri, 24 Apr 2020 08:45:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B3928E0003; Fri, 24 Apr 2020 08:45:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0A8F8E0005; Fri, 24 Apr 2020 08:45:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id D6DD88E0003 for ; Fri, 24 Apr 2020 08:45:03 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9B3B1180AD811 for ; Fri, 24 Apr 2020 12:45:03 +0000 (UTC) X-FDA: 76742718486.11.pot21_2c23eb5514530 X-HE-Tag: pot21_2c23eb5514530 X-Filterd-Recvd-Size: 6042 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Apr 2020 12:45:03 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id 19so10140124ioz.10 for ; Fri, 24 Apr 2020 05:45:03 -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=C9eaDvvJ77XZj4T792zYETZIjpst74RXf8cetFIYTV0=; b=IPtI4KQHxwUwaaA8eOqyqVqQPA+KsITCVvkSTir8OP6/4c4rXQELT0ZEIzfsLYliYO pyr69zy7+lTXHBIxL+LPnQClEPDnfyS7uuDVUjsuARqB+IsdlVW9Cx1pijGKawS6UXNO trNHaCuch69bbRxLkZHDmnjudOlu+iSeFsX+OWp4Ix+aMmmdWQh129dODnP5xph0dBNW gGel7/TsdFG8AEAb7MyQo11a43rR4OLRlP4cAOPbtjaUu1zJFOQERh9Yz2IQnPfTPROb WMUE5pGZ2ee4WMem+hGjie8dj1DS1ViNXe8Eou7m3q8wsRdVczlUKvigFeBFZT5Dt02U Jhcg== 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=C9eaDvvJ77XZj4T792zYETZIjpst74RXf8cetFIYTV0=; b=ktOqjvAoVUIQKY/FHi5teXFH8vc7fxXLFaN/D8NvjxwdziEQfOjPiINlxaK8j87Byl rzOimbg1hq1/sUNpLQs+WpetKa21YrFKDiVl+uDEbJD4ieUbZsB0aiAoWgjTW1/5GOrC tLupEhHxCv+NgdGbIJz/Wc4NWrOdd6y1ffYg8jLUFL3HvfPiV72jfys7s82DKcZafklR NByQ1XdeYQcp1KBf4hXrYAvFcBpmkkcXe+3sNm2eUHB13pJCtnI0UzF1VQLQSOg03xPE mBQqRIUHw/JzkaNZc0Reo0JF84k4T4xNfNEEa9MPmcJNSbSQSiOuEXaHXZhbOy+u23TF I6VA== X-Gm-Message-State: AGi0PuZdCwcZdvesY3VaMemqA4s5AOIsDJPpwEtpqbHX+U71vgh+YKS3 hu3I2uMciHDghAX1njuokArZYnD/4e1Ad8y4l26J0f54 X-Google-Smtp-Source: APiQypIGw+Uo04vrJIk/6ymlihcuQUMRs9FYS8HnwngrnrOwSaCM2SxMHpHnlobzxTtBAnMoIROEaEtYr7npH+7/PvQ= X-Received: by 2002:a05:6602:199:: with SMTP id m25mr8464280ioo.13.1587732302623; Fri, 24 Apr 2020 05:45:02 -0700 (PDT) MIME-Version: 1.0 References: <20200423061629.24185-1-laoar.shao@gmail.com> <20200423153323.GA1318256@chrisdown.name> <20200424121836.GA1379200@chrisdown.name> In-Reply-To: <20200424121836.GA1379200@chrisdown.name> From: Yafang Shao Date: Fri, 24 Apr 2020 20:44:26 +0800 Message-ID: Subject: Re: [PATCH] mm, memcg: fix wrong mem cgroup protection To: Chris Down Cc: Andrew Morton , Michal Hocko , Vladimir Davydov , Linux MM , Roman Gushchin , 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 8:18 PM Chris Down wrote: > > Yafang Shao writes: > >If the author can't understand deeply in the code worte by > >himself/herself, I think the author should do more test on his/her > >patches. > >Regarding the issue in this case, my understanding is you know the > >benefit of proportional reclaim, but I'm wondering that do you know > >the loss if the proportional is not correct ? > >I don't mean to affend you, while I just try to explain how the > >community should cooperate. > > I'm pretty sure that since multiple people on mm list have already expressed > confusion at this patch, this isn't a question of testing, but of lack of > clarity in usage :-) > > Promoting "testing" as a panacea for this issue misses a significant part of > the real problem: that the intended semantics and room for allowed races is > currently unclear, which is why there is a general sense of confusion around > your proposed patch and what it solves. If more testing would help, then the > benefit of your patch should be patently obvious -- but it isn't. I have shown a testcase in my commit log. Bellow is the result without my patch, [ 601.811428] vmscan: protection 1048576 memcg /foo target memcg /foo [ 601.811429] vmscan: [ 601.811429] vmscan: protection 1048576 memcg /foo target memcg /foo [ 601.811430] vmscan: [ 601.811430] vmscan: protection 1048576 memcg /foo target memcg /foo [ 601.811431] vmscan: [ 602.452791] vmscan: protection 1048576 memcg /foo target memcg /foo [ 602.452795] vmscan: [ 602.452796] vmscan: protection 1048576 memcg /foo target memcg /foo [ 602.452805] vmscan: [ 602.452805] vmscan: protection 1048576 memcg /foo target memcg /foo [ 602.452806] vmscan: [ 602.452807] vmscan: protection 1048576 memcg /foo target memcg /foo [ 602.452808] vmscan: Here's patch to print the above info. diff --git a/mm/vmscan.c b/mm/vmscan.c index b06868fc4926..7525665d7cec 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2344,10 +2344,18 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, unsigned long lruvec_size; unsigned long scan; unsigned long protection; + struct mem_cgroup *target = sc->target_mem_cgroup; lruvec_size = lruvec_lru_size(lruvec, lru, sc->reclaim_idx); protection = mem_cgroup_protection(memcg, sc->memcg_low_reclaim); + if (memcg && memcg != root_mem_cgroup && target) { + pr_info("protection %lu memcg ", protection); + pr_cont_cgroup_path(memcg->css.cgroup); + pr_cont(" target memcg "); + pr_cont_cgroup_path(target->css.cgroup); + pr_info("\n"); + } if (protection) { So my question is that do you think the protection in these log is okay ? Can you answer me ? Hint: what should protection be if memcg is the target memcg ? -- Thanks Yafang