Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1281744lfc; Wed, 1 Jun 2022 14:06:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjFaMI79WKLnWYjvqhZN1BP05HubCpEKtnt9oN7lf9Ppra5c+jfcm4eYzZCoUo8YcrNj2t X-Received: by 2002:a17:90b:1b05:b0:1e2:a053:2fad with SMTP id nu5-20020a17090b1b0500b001e2a0532fadmr25916194pjb.209.1654117612538; Wed, 01 Jun 2022 14:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654117612; cv=none; d=google.com; s=arc-20160816; b=j2qI+o80KbizDxKQnE0vO0DKLXWKa61wj4Kz6nFh1r/sGGDwgDg7XWwYBOqdiM5o6N /zltPK6CHtFTIqDmWnZfBZJnEkbX3tUHK6KH2M2RDfQybtukHmnwHTLS4jauBBy9N5vl U6aWqcPzplSHCjMabtJPqX8MB/+fola/F72QSvNCSQNlCKhJc3U/BayDQD/u2Md41QHa /AAUNzOvNmb48OdyluDgCwvmbCY3rd0PDWdjI6CrlTjEe0AY3TeLqZm3YSukhamBP5zR NTy8Jje+jdIxCCIAwiQLawgZ8V41KZ2nlu5FQFBQpYrVw09kmphdroA0c1cBh5H5ZKgK ggXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GjM3NNyZi+mdyAAgbPoVYQ4gLBCkOnK/73Cw9/lkEMA=; b=gj6d8qC3noTL6mUWl/YN5Ji0+2x/tu7p7ARvQhIlLzM+eX8MfFxezOxNHfV82PA/pN sRL/3I69nOIPjw24xnF/Rn138FQjgfT0/aErTPEROyyWGZnsD0fY6lqKiTRl1YcloXay SirhbcZsjUIDdui7LI6JTtGJmHOmECZLHBg7b+xzct1gbhM8hWVs8jP+2EZW87KrGaAN qP31+hjjMLg5CO1GX5BT/wcU4TA48IQtF6JUAZZkIA/w1MXwkpwfiTZTLYshDdukP2nl reY20OUbqsHwfx6fJVg1/Ca+ezi+qnJmh22tFobDciXnvHb7Pw9rvEVHeprMq4n3CoGj TeKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fMgAUfgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 1-20020a620401000000b005107be11e23si3128463pfe.137.2022.06.01.14.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fMgAUfgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3810D2FEF64; Wed, 1 Jun 2022 13:14:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356385AbiFARet (ORCPT + 99 others); Wed, 1 Jun 2022 13:34:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356377AbiFARen (ORCPT ); Wed, 1 Jun 2022 13:34:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B08838B095; Wed, 1 Jun 2022 10:34:41 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6F1281F8F6; Wed, 1 Jun 2022 17:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654104880; h=from:from:reply-to: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=GjM3NNyZi+mdyAAgbPoVYQ4gLBCkOnK/73Cw9/lkEMA=; b=fMgAUfgOUjfloaDS4p8wAJAzvluuJQWZvnxiAi6ShSWltsPq3megQImODM+d9HSmLxJwFW MPWNEw2VE8jdwfgtsn50e1wTFaVQCwr62zTR8vifW9Q6K6zdvBem445A38lxWHjrF3MLUd 99BaPGC4eSxt1lgF0sZWfxXLV2fja2o= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 357AE1330F; Wed, 1 Jun 2022 17:34:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vwgcDDCjl2LpaQAAMHmgww (envelope-from ); Wed, 01 Jun 2022 17:34:40 +0000 Date: Wed, 1 Jun 2022 19:34:38 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Muchun Song Cc: hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com, longman@redhat.com Subject: Re: [PATCH v5 09/11] mm: memcontrol: use obj_cgroup APIs to charge the LRU pages Message-ID: <20220601173438.GC2434@blackbody.suse.cz> References: <20220530074919.46352-1-songmuchun@bytedance.com> <20220530074919.46352-10-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220530074919.46352-10-songmuchun@bytedance.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hello Muchun. On Mon, May 30, 2022 at 03:49:17PM +0800, Muchun Song wrote: > +static inline bool obj_cgroup_is_root(struct obj_cgroup *objcg) > +{ > + return objcg == root_obj_cgroup; > +} Admittedly, this predicate alone caught my eye, why it did not also check root_mem_cgroup->objcg_list. However, deeper look reveals it's purpose is to avoid missing uncharges of pages that were charged in non-root memcg and later re-associated upwards after reparenting. So it's like obj_cgroup_root_origin() (I'm not suggesting a rename, just illustrating the understanding). get_obj_cgroup_from_current() gains some complexity but it still holds that in root memcg neither kernel objects nor LRU pages are charged. At the same time, reparented kernel objects or LRU pages are properly uncharged. These parts are Reviewed-by: Michal Koutn? (I did not look into the locking guarantees with the new API though.)