Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2347702rwb; Fri, 16 Dec 2022 00:21:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXusyXfwX9lI3QkpLXadbzEfkpi+KoIynK315qBk9fmZSHIhdfJGilPWxq4hgxt5ZxznSuUu X-Received: by 2002:a17:906:b195:b0:7c4:fe41:f0da with SMTP id w21-20020a170906b19500b007c4fe41f0damr7542378ejy.25.1671178913658; Fri, 16 Dec 2022 00:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671178913; cv=none; d=google.com; s=arc-20160816; b=0nX9xO67LnhDVvLSJ0bEdBtgAmkYMJ5Rey+RgckUikDfWzwdieeDafp8hwP9wJYkLA pMNXI878waHTva1qKy0FCWQ+3XUqIkdiJVDx3VEy2YrKtKWyAAwm37BfXI+lrDmkRzEG 654+3KOckiwmWJaCBA+rfa3Jjw0J4kbPpHqYiUzxVritwTv6l6ELV3V8I5Vl1BBNV5Ta wu+OtFops4pyMzhKSW7Dua7dFJpnsTdm1qR3etFv02WLGOsqXLJdCScrqfuVJUmC/2UD jPYnxzMnw9UbJDE7tfe5YAy0oCwra2w24tKB7f2/cnf5T8SFa2iABvlCtcoqGVY2uuud hSDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=plqPOP9E2ubaoFS6DW5h9ydb8poIl/D4ntZ2wVLE5E4=; b=obP04CQbimt9wrFiBL8wk739BkDxuLZbC51EwbLTuvfJHww0M7mOupR6yqMKV8mPvD rp+CU4X7PDdoobaapexgYJBj/QQKimNSGRSNAvgVo/tW8rT6DMwVdi7urj2bv20k/rmp vYgdmRggbpyFcW27iiXlSG57uu76QdMdZTOn8YR5XzdXXzvUmvpzvIj8BQmEezQoqrjy gIbHTho2mj1s1yB152Oe/fDrtnbx3obiDVxbxp2kLjFA09tocIG+g7ggK+Xj7n+WdPl3 eOCBtv+E8iHGHYiafu3doMopg9Dfi4sRsuEnfZANkOwJ8ISsv+zxwJ6VAg7UcT9vukR4 FXVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=juS+nlVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw20-20020a170907a0d400b00781d82a6fc9si1521570ejc.264.2022.12.16.00.21.37; Fri, 16 Dec 2022 00:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=juS+nlVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbiLPHu7 (ORCPT + 68 others); Fri, 16 Dec 2022 02:50:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbiLPHu4 (ORCPT ); Fri, 16 Dec 2022 02:50:56 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2992711C0A for ; Thu, 15 Dec 2022 23:50:55 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id c13so1246421pfp.5 for ; Thu, 15 Dec 2022 23:50:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=plqPOP9E2ubaoFS6DW5h9ydb8poIl/D4ntZ2wVLE5E4=; b=juS+nlVgzXB56Is+QqBJn2KSMNY50ggwA3GhylkR4NV+7iKJRyDprWzbFYHSU7a83K Z464sRmXE5SDWbekroWAh6eZqujmB6DwngG9ACGNnnmOIbShKtMY3K9zBFpis5l608qy gbW7B6+1LR0vCv99Ebh5peUqSdKwrmstPBshCX5A0FTKuzZ6ZgSQlBiCUCc34OL/+g2w vxfKDZZopoCywV3a493NiA2LfuI+CFJF6s8XG61SXc2kEeu1jcvIq990VGCwGoG5TeZX xvxB6ORI7WbNe2Hx95c/zs/TKsPFqmD7ASlqadDBFkFbyOIBQhQkYU2wjN3S09EM7JDh 5HLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=plqPOP9E2ubaoFS6DW5h9ydb8poIl/D4ntZ2wVLE5E4=; b=brv3b8v4yQGXtLHA/V0ISLWqYgxUGZ5aWivbuT19jab5W8ugdF4R5j19cQJ4JpBi9P Dx/3cfshzLPNsL5Tw/Fw0UIvtvET4x/JV9u+Jhyw6vVEasQ9QdD9cuDcc+/CI6EfAkJv 9S0Am13TMzx7LvDsQ+bdFinu27TNJHM+7FrwuJhhTSo3j1hPzKhP/pa8RAyQPCO6UPAd oOq0yxfk/M9sal71kvxT5JPOGkewQICIdMNnx5xtMnu55uxIyvg9ME/D5Nh8kUw8MT4T utJK1zuzI4VLFORndMr9dz2ZSfypdtVg+WnEOqnJhkuJ54MLwyORkwrQ+zjZy78tSvne sXJg== X-Gm-Message-State: ANoB5pmc6P0vLM7AD8t9haXR/jXjEGolDwQkwjRVEy6YrNdvGNvAWUgl MqkVWkbT50yk8kKCsNcRuNOcgQ== X-Received: by 2002:a05:6a00:1d04:b0:578:8533:9573 with SMTP id a4-20020a056a001d0400b0057885339573mr17844250pfx.22.1671177054676; Thu, 15 Dec 2022 23:50:54 -0800 (PST) Received: from [10.54.29.146] (static-ip-147-99-134-202.rev.dyxnet.com. [202.134.99.147]) by smtp.gmail.com with ESMTPSA id p8-20020aa79e88000000b005748029bab8sm817596pfq.156.2022.12.15.23.50.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Dec 2022 23:50:54 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2022 15:50:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] mm/memcontrol: Skip root memcg in memcg_memory_event_mm To: Shakeel Butt Cc: akpm@linux-foundation.org, roman.gushchin@linux.dev, songmuchun@bytedance.com, hannes@cmpxchg.org, vbabka@suse.cz, willy@infradead.org, vasily.averin@linux.dev, linux-kernel@vger.kernel.org References: <20221215091907.763801-1-haifeng.xu@shopee.com> <20221215181803.ome46pkh6g7qu3t4@google.com> <20221216064210.krxtxebuwc7dijzu@google.com> <13c73151-4b28-4324-afd5-8b84b82bc25d@shopee.com> <20221216073640.xjtpsyigoej77v5h@google.com> From: Haifeng Xu In-Reply-To: <20221216073640.xjtpsyigoej77v5h@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/12/16 15:36, Shakeel Butt wrote: > On Fri, Dec 16, 2022 at 03:28:53PM +0800, Haifeng Xu wrote: >> >> >> On 2022/12/16 14:42, Shakeel Butt wrote: >>> On Fri, Dec 16, 2022 at 09:43:02AM +0800, Haifeng Xu wrote: >>>> >>>> >>>> On 2022/12/16 02:18, Shakeel Butt wrote: >>>>> On Thu, Dec 15, 2022 at 09:19:07AM +0000, Haifeng Xu wrote: >>>>>> The memory events aren't supported on root cgroup, so there is no need >>>>>> to account MEMCG_OOM_KILL on root memcg. >>>>>> >>>>> >>>>> Can you explain the scenario where this is happening and causing issue >>>>> for you? >>>>> >>>> If the victim selected by oom killer belongs to root memcg, memcg_memory_event_mm >>>> still counts the MEMCG_OOM_KILL event. This behavior is meaningless because the >>>> flag of events/events.local in memory_files is CFTYPE_NOT_ON_ROOT. The root memcg >>>> does not count any memory event. >>>> >>> >>> What about v1's memory.oom_control? >>> >> >> The memory.oom_control doesn't set the CFTYPE_NOT_ON_ROOT flag. But oom_kill_disable or >> under_oom actually only support non-root memcg, so the memory_events should be consistent >> with them. > > Did you take a look at mem_cgroup_oom_control_read()? It is displaying > MEMCG_OOM_KILL for root memcg. Irrespective it makes sense or not, you > want to change behavior of user visible interface. If you really want to > then propose for the deprecation of that interface. Yes, I have see it in mem_cgroup_oom_control_read() and I think that showing MEMCG_OOM_KILL for root memcg doesn't make much sense. Shoud I add the CFTYPE_NOT_ON_ROOT flag for cgroup v1?