Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3954198pxu; Tue, 20 Oct 2020 05:05:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2RTpj3TpmIfPEEs5zb6KcU6w1Umm2J1DYwSniYYKi9j3r9V9feDqfsa+WyaOqmGk7Gpmq X-Received: by 2002:a17:906:e2d1:: with SMTP id gr17mr2727347ejb.433.1603195506212; Tue, 20 Oct 2020 05:05:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603195506; cv=none; d=google.com; s=arc-20160816; b=C5x+zUepqzf7iWDGA5sB/PspzgWxAbmjqEMKHv/9xvRyUf0Wt1KU+WS3wnO/yCMHN2 63adBFEWdtaunbgIB2xchorWk3LxPuIJKRbgx2w7rE0d6BjSF/LK8BIm5jY0Twz53dy9 rTVe7n7fQTNwXgd6RNr5kOQp7SIUTXPsS+4bJVJ93w3RhZcEW/5ul5jd4lxBnWbLF+be MvczgsMLMahvqbCkByVwsinyW8V/NjGaoEd/XSB/+Lk5OJ8AFdnSNitR8HbIWeWcBv+D Rc8U0g6rDYrRHhRqXBJl8pRaqmBnmAVVQtMICAYOD7kLndW8hKwwFP8P/kpSaL3S44em wFUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to :reply-to:subject:cc:to:from:user-agent:references; bh=T6GAmIzJ1pyJnF6B01ZeJUgmeuZ55VWMuAf5lBmrhiw=; b=WfJjzjhyyWs+CfLtyM2TtLFWNGzJiMuj8mLgQ0cvEG6j33RUMFNyCaPLVRIrNqst4i WoV/7unUU0aV9xaJaObYJJJJ6IdBmycCk0MBrc1FTmpA8RxL8S+vIleyZSeeqkDHRAAy ZJ9YiKr/7S3eX3vUMQl9gM3oPNuBwgedUmclbPp3/vf6K9nlL1Ufbrxw5mfX4WCq0Vvb krIQ7yPvT6rQupusPQldWtsLVh+mAwAeSYH3SM6F5E6tmkdJs3nWRJInFGHMLzfxd/Be 84xqH9G8/uluMCCshxZbdJk9gAsyP3PsGsPve8mK3/PBrAUYke76kM8yw6lRBnTvKHmJ +Gdg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si972297edw.368.2020.10.20.05.04.44; Tue, 20 Oct 2020 05:05:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394203AbgJTMCl (ORCPT + 99 others); Tue, 20 Oct 2020 08:02:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:42070 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394130AbgJTMCi (ORCPT ); Tue, 20 Oct 2020 08:02:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 01499ABD1; Tue, 20 Oct 2020 12:02:37 +0000 (UTC) References: <20201014190749.24607-1-rpalethorpe@suse.com> <20201016094702.GA95052@blackbook> <20201016145308.GA312010@cmpxchg.org> <20201016171502.GA102311@blackbook> <20201019222845.GA64774@carbon.dhcp.thefacebook.com> <87k0vlwhzt.fsf@suse.de> User-agent: mu4e 1.4.13; emacs 27.1 From: Richard Palethorpe To: Roman Gushchin Cc: Michal =?utf-8?Q?Koutn=C3=BD?= , Johannes Weiner , ltp@lists.linux.it, Andrew Morton , "Shakeel Butt" , "Christoph Lameter" , Michal Hocko , Tejun Heo , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko Subject: Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root Reply-To: rpalethorpe@suse.de In-reply-to: <87k0vlwhzt.fsf@suse.de> Date: Tue, 20 Oct 2020 13:02:35 +0100 Message-ID: <87h7qpw1es.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Richard Palethorpe writes: > Hello Roman, > > Roman Gushchin writes: > >> - page_counter_init(&memcg->memory, NULL); >> - page_counter_init(&memcg->swap, NULL); >> - page_counter_init(&memcg->kmem, NULL); >> - page_counter_init(&memcg->tcpmem, NULL); >> + /* >> + * If use_hierarchy == false, consider all page counters direct >> + * descendants of the corresponding root level counters. >> + */ >> + page_counter_init(&memcg->memory, &root_mem_cgroup->memory); >> + page_counter_init(&memcg->swap, &root_mem_cgroup->swap); >> + page_counter_init(&memcg->kmem, &root_mem_cgroup->kmem); >> + page_counter_init(&memcg->tcpmem, &root_mem_cgroup->tcpmem); >> + >> /* >> * Deeper hierachy with use_hierarchy == false doesn't make >> * much sense so let cgroup subsystem know about this > > Perhaps in this case, where the hierarchy is broken, objcgs should also > be reparented directly to root? Otherwise it will still be possible to > underflow the counter in a descendant of root which has use_hierarchy=0, > but also has children. Sorry ignore me, parent_mem_cgroup already selects root. So in the case of a broken hierarchy objcgs are reparented directly to root. -- Thank you, Richard.