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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 0A373C4727D for ; Wed, 30 Sep 2020 01:34:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BE5E20C09 for ; Wed, 30 Sep 2020 01:34:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BE5E20C09 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5FE836B005D; Tue, 29 Sep 2020 21:34:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AEF76B0068; Tue, 29 Sep 2020 21:34:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 476B96B006C; Tue, 29 Sep 2020 21:34:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 310D26B005D for ; Tue, 29 Sep 2020 21:34:31 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EA4151E06 for ; Wed, 30 Sep 2020 01:34:30 +0000 (UTC) X-FDA: 77318007900.30.pipe67_5417b772718e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id C86DF180B3C85 for ; Wed, 30 Sep 2020 01:34:30 +0000 (UTC) X-HE-Tag: pipe67_5417b772718e X-Filterd-Recvd-Size: 2923 Received: from huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 01:34:30 +0000 (UTC) Received: from dggeme754-chm.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id 6C77C6E78A2F08F9E911; Wed, 30 Sep 2020 09:34:26 +0800 (CST) Received: from dggeme753-chm.china.huawei.com (10.3.19.99) by dggeme754-chm.china.huawei.com (10.3.19.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Wed, 30 Sep 2020 09:34:25 +0800 Received: from dggeme753-chm.china.huawei.com ([10.7.64.70]) by dggeme753-chm.china.huawei.com ([10.7.64.70]) with mapi id 15.01.1913.007; Wed, 30 Sep 2020 09:34:26 +0800 From: linmiaohe To: Michal Hocko CC: "hannes@cmpxchg.org" , "vdavydov.dev@gmail.com" , "akpm@linux-foundation.org" , "cgroups@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] mm: memcontrol: remove obsolete comment of mem_cgroup_unmark_under_oom() Thread-Topic: [PATCH v2] mm: memcontrol: remove obsolete comment of mem_cgroup_unmark_under_oom() Thread-Index: AdaWyYPX/CSq6v+NO0CRyyk8/6/gYg== Date: Wed, 30 Sep 2020 01:34:25 +0000 Message-ID: <7d1ea112d8a740cab555eaf7be530286@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.176.109] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.001960, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Michal Hocko wrote: > On Thu 17-09-20 06:59:00, Miaohe Lin wrote: >> Since commit 79dfdaccd1d5 ("memcg: make oom_lock 0 and 1 based rather=20 >> than counter"), the mem_cgroup_unmark_under_oom() is added and the=20 >> comment of the mem_cgroup_oom_unlock() is moved here. But this comment=20 >> make no sense here because mem_cgroup_oom_lock() does not operate on und= er_oom field. > >OK, so I've looked into this more deeply and I finally remember why we hav= e this comment here. The point is that under_oom shouldn't underflow and th= at we have to explicitly check for > 0 because a new child memcg could have= been added between mem_cgroup_mark_under_oom and mem_cgroup_unmark_under_o= om. > >So the comment makes sense although it is not as helpful as it could be. >I think that changing it to the following will be more usefule > > /* > * Be careful about under_oom underflows becase a child memcg > * could have neem added after mem_cgroup_mark_under_oom Should it be s/neem/been/ ? > */ Many thanks for detailed explanation. Will fix it in v2. Thanks again.