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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7232AC433B4 for ; Mon, 19 Apr 2021 21:24:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9EC261279 for ; Mon, 19 Apr 2021 21:24:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9EC261279 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2B5FD6B0070; Mon, 19 Apr 2021 17:24:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2674C6B0071; Mon, 19 Apr 2021 17:24:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B8FB6B0072; Mon, 19 Apr 2021 17:24:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id E026F6B0070 for ; Mon, 19 Apr 2021 17:24:26 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 916EE181AEF31 for ; Mon, 19 Apr 2021 21:24:26 +0000 (UTC) X-FDA: 78050395332.04.12071DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf15.hostedemail.com (Postfix) with ESMTP id D840EA00038D for ; Mon, 19 Apr 2021 21:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618867465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wmgc0BS4/Q3289dtVfzWyet+zhdbOakz2oUo7zL63L8=; b=dhFcRLXV2tXDrv2zLjNLZw4Y1P79aL4shmksee6prNMqIt4sQhOp1zTfDSXPaEdM83mdlD /nxW/cpmcyrvKF+hKM3/Bh/4tAAcFfAmxCQIJyYSJ4iD83+qPkzRf9/eQM/vPLECAmpV9L 2+Rph6tzZFPjVeA19GkhzZ+Z+yrq4o8= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-06Orp2CkM566C-hl8u2WIA-1; Mon, 19 Apr 2021 17:24:23 -0400 X-MC-Unique: 06Orp2CkM566C-hl8u2WIA-1 Received: by mail-qk1-f199.google.com with SMTP id e4-20020a37b5040000b02902df9a0070efso5709752qkf.18 for ; Mon, 19 Apr 2021 14:24:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Wmgc0BS4/Q3289dtVfzWyet+zhdbOakz2oUo7zL63L8=; b=si5Fwkn6BoqyVjsZnpEumsCyn2FzOfaa0ywvbRGrIQp0h5Os472vXMECw0wQEq7Jr7 5+7evgrtmgBxy51JvAQPfMjr/rQm1xlMkuDs5xiBzM+LdilvyQ7l04pu1q6bIm6IFp97 fS6l2OaVvda+aLYvFNH+8BpIr8htx0PnQ6buHJC0XD/9eczOAPanjf2yFsKIiuMpCp0a 1h4fL7TJiO9qrrAKCGFiPmPqJfe3WbqGkHTAwSQKxnOZNnTRcOk0w1g8lh2oZqmbF6ar sASLXeo8FtD3//edOtGqR4YwX3jT5kj2WzD/7vGUFZnRsOVKtml9iPfdIIZ7PNqwZhNo A9cA== X-Gm-Message-State: AOAM532x1cU/OeO9fyZyNElBSi20wmj9tou3MOngZGkJrd5jLxSdpdSj amBE8vKawSueo8tJDJy4wEBHOV5Ez9Sy1xEp616/xLvMaa2iDFPF42LwW1GF9vsxN+huOVZKUJ5 /ALWSLP6xcvI= X-Received: by 2002:a37:8184:: with SMTP id c126mr14086907qkd.353.1618867463396; Mon, 19 Apr 2021 14:24:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4FLubBFrEkXj33csDxvgbw+/gusWYsbykbD8A8Hymwn6ZZwBB+TSD06sOCo/kXS0LWCU1pg== X-Received: by 2002:a37:8184:: with SMTP id c126mr14086886qkd.353.1618867463222; Mon, 19 Apr 2021 14:24:23 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id q23sm10293947qtl.25.2021.04.19.14.24.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 14:24:22 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c To: Johannes Weiner , Waiman Long Cc: Michal Hocko , Vladimir Davydov , Andrew Morton , Tejun Heo , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Muchun Song , Alex Shi , Chris Down , Yafang Shao , Wei Yang , Masayoshi Mizuma , Xing Zhengjun , Matthew Wilcox References: <20210419000032.5432-1-longman@redhat.com> <20210419000032.5432-2-longman@redhat.com> <140444ea-14e7-b305-910f-f23fafe45488@redhat.com> Message-ID: <18fc7f4c-d44e-8651-6593-a3e89147e230@redhat.com> Date: Mon, 19 Apr 2021 17:24:20 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=llong@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Stat-Signature: ahudwpkh5c9yi5g8e9w1iaoyaandu648 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D840EA00038D Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618867463-94784 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 4/19/21 5:11 PM, Johannes Weiner wrote: > >> BTW, have you ever thought of moving the cgroup-v1 specific functions out >> into a separate memcontrol-v1.c file just like kernel/cgroup/cgroup-v1.c? >> >> I thought of that before, but memcontrol.c is a frequently changed file and >> so a bit hard to do. > I haven't looked too deeply at it so far, but I think it would make > sense to try. > > There are indeed many of the entry paths from the MM code that are > shared between cgroup1 and cgroup2, with smaller branches here and > there to adjust behavior. Those would throw conflicts, but those we > should probably keep in the main memcontrol.c for readability anyway. > > But there is also plenty of code that is exclusively about cgroup1, > and which actually doesn't change much in a long time. Moving that > elsewhere shouldn't create difficult conflicts - maybe a few line > offset warnings or fuzz-- Rafael > > > in the diff context of unrelated changes: > > - the soft limit tree and soft limit reclaim > > - the threshold and oom event notification stuff > > - the charge moving code > > - remaining v1 interface files, as well as their helper functions > > From a quick scan, this adds up to ~2,500 lines of old code with no > actual dependencies from the common code or from v2, and which could > be moved out of the way without disrupting ongoing development much. > Right. Currently memcontrol.c has over 7000 lines of code and keep growing. That makes it harder to read, navigate and update. If we can cut out 2000 lines or more from memcontrol.c, it will make it more manageable. Cheers, Longman