Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2799931pxb; Mon, 19 Apr 2021 14:26:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSgdBZYXH6rF2mD6yssOXjWZupcM1+p9onVRMLqXgGEjgkafBs4nZnP0L7lxWlIQxJD1EU X-Received: by 2002:a63:eb12:: with SMTP id t18mr13901772pgh.349.1618867563361; Mon, 19 Apr 2021 14:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618867563; cv=none; d=google.com; s=arc-20160816; b=b7uaLKlE2AanLUZcBRq4CbmCFZyU8DezY/VjLSm/0gNcxDIxKLkvZV++TbebJX06au gM58D6rgedAuesSW1v6BZNkb2aBvwjq+RdeAG7p6t+1qudZU6LR2jGXedmMuRqW+6Gr3 1FHfi5NhseiET9IfabLc9J8aBJlV3YVSgBX//AuXNrUFnpeuLx3wUk5vmfa8gXZ0v0rn 6QaG9CBTLqnSMJ24r+MLWa6+mDN3y+O4nVOGoEXB4570xRNqufi45bs1sB1gu9sKPZ/S k0QlRqcZgEskO7kJqv46tBDQdoJcNrEcZLJsCMuP4TKBZvZlbTBm39q6R0K2X9mZd9NY Xtxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dkim-signature; bh=Wmgc0BS4/Q3289dtVfzWyet+zhdbOakz2oUo7zL63L8=; b=vcx2PtSIKwdiBYbelYJn+NxtwKOTLessmT6euaNT5CKx3324Mdq59XR0p7lshhTtKa fcA52cASHx6xOCJ98u4cOLaQ3AgckQWWrSeqVmPZHMqMuuKpHBh/ASL1DPWsarzA0rbe fb94sWnHH8vIPXYgE4Kg6T3N2eIepfrKUaBDs6iGswbYhWdYpvAhWx+UIQISV73e2O+D eWczlathTtB0aowUh5IhpQZyg9kXElMsKRjVCJRs3bkDAcSKf9q75sFfVOEEwePi3Y3q 9d0k/R48t5MQ4heIKFonkdgDMAIaqu7OuLajdJDtQnEfQVm9Jc6VCst2PoUii21txRr1 LDwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dhFcRLXV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si577582pjf.94.2021.04.19.14.25.40; Mon, 19 Apr 2021 14:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dhFcRLXV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbhDSVZC (ORCPT + 99 others); Mon, 19 Apr 2021 17:25:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56332 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhDSVYz (ORCPT ); Mon, 19 Apr 2021 17:24:55 -0400 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-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-6TMyqEQcNt2xnAY5jZaIXA-1; Mon, 19 Apr 2021 17:24:23 -0400 X-MC-Unique: 6TMyqEQcNt2xnAY5jZaIXA-1 Received: by mail-qt1-f200.google.com with SMTP id i7-20020ac84f470000b02901b944d49e13so2084254qtw.7 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=FJ1p81esVxHUtFOI/OGJDh/V9cehT0TlF1wCuYuUNoRhrVVk5JWX9zY+BMZKeDpUjz XnUAM7K9NDnelJA41SGyr/kcOxUXiMdJTNNIuMi5Vm2W71OSjSJhgzfyBnbF8ZUgpU1Y Pmi08EHACvV14e+RZ8QDiUwmFk/i9HjSoVoBBUDGumt0rHI287XMvsywOhKDmBv7KHIZ OiVqZSmANkBbh7wWSuvBXQPynVug15vPxEX59vrNRUMkKPkp/kZEfAHbSPDu4mmhdaft L8uXfFFujCATWanHyxruhr3CuZ8jaeFixWX4SwImOCt9DnH1txUD/RSwnJ6kngQwbRd6 7izw== X-Gm-Message-State: AOAM530L49yg2Usd6FMLlOU+yyzB0ag/rfHoKL5BazBL+IdQ3MD3sX8t gNITrvmw/eXXjMj/tKMUuNmtgMMo61kEk761xtAujUA8R3YiRsUqhXRovlB8AqfTOYOKPXe+7rz qAEDOCLaypTtzWNfzn6SClReS X-Received: by 2002:a37:8184:: with SMTP id c126mr14086913qkd.353.1618867463396; Mon, 19 Apr 2021 14:24:23 -0700 (PDT) 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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