Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp945478pxu; Thu, 15 Oct 2020 22:48:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwhYXUkHz/9Dhxx5a2W1g72DuFSayQhuX/f5TB5f33pC5ybXlXl6fdE+jgv92fdSafLpCn X-Received: by 2002:a50:c05b:: with SMTP id u27mr1975148edd.290.1602827338337; Thu, 15 Oct 2020 22:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602827338; cv=none; d=google.com; s=arc-20160816; b=eFMs6sJw4NHwfDoc1MvchncGAju4Zb/4v08ARe/Gj/y1u94l529h/0BUc5kXoKkkAD FGayfMbGyTLXFvwbx+MFmRzi2SLOXs4C8DZc8lEjdseEQYW8uLunfNPdcrOly3AEe+2q fkd7trJIwTvU6VS2a4BID5/bbEVY+BH2FQg7JSHrUkthys9AaI0481BfvLo5GQhzlJlW b+6961Amx/Dyghvf22SwucN4j9U8LS5589l69pCO7HlEgUW7ota2yvXt6WydYBcW4QxZ /3R96/CGX6pB6nOoCVCWVIbBH2LZ37bNWyNwa/Aab/OB4t2Zuqv8By18Hkb/VT/wJUUG 6dAQ== 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=jdBolKxslPvHsiRCvyowPH35U5Q6WwZFc7kMNUOP1t8=; b=rzpVXm5BPzVtSNVxRyJzi0xf5mFNbg8aW4lNNErkxV2NDGG2EG5yZEGXfA/XpiLv+A HwKEAACf65jnfhAeaxA29N72UCeyWNaKebBEaQESEd1y8uO06jOSzAGYlr5yeY1T7wQO rY2aPkddZuMlqJmrSrmrRCkK+sUJ+ZRzmv6nQyYaYUsknkvg9t6rKmlsWuffqqRdD1HZ J8pTNps6jmHQ8/dNLSy7NkNYU2KxGZXbmDjDScUqYHUfsxclocOuBJA0LzIwYj/QQzb8 TQqPPCmXS/gv+IRdAdFhmqeSMVmzswiwcLtZPIiV+ZET4yi5oImZEJcqEd+2pMe3xQib AT6g== 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 v27si1038914ejq.250.2020.10.15.22.48.36; Thu, 15 Oct 2020 22:48:58 -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 S2388741AbgJPFlA (ORCPT + 99 others); Fri, 16 Oct 2020 01:41:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:55714 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732871AbgJPFlA (ORCPT ); Fri, 16 Oct 2020 01:41:00 -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 B9BECADC2; Fri, 16 Oct 2020 05:40:58 +0000 (UTC) References: <20201014190749.24607-1-rpalethorpe@suse.com> <20201014200833.GA19363@carbon.lan> User-agent: mu4e 1.4.13; emacs 27.1 From: Richard Palethorpe To: Roman Gushchin Cc: ltp@lists.linux.it, Johannes Weiner , Andrew Morton , Shakeel Butt , "Christoph Lameter" , Michal Hocko , Tejun Heo , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root Reply-To: rpalethorpe@suse.de In-reply-to: <20201014200833.GA19363@carbon.lan> Date: Fri, 16 Oct 2020 06:40:57 +0100 Message-ID: <87v9fasp7a.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Roman, Roman Gushchin writes: > Hi Richard! > >> SLAB objects which outlive their memcg are moved to their parent >> memcg where they may be uncharged. However if they are moved to the >> root memcg, uncharging will result in negative page counter values as >> root has no page counters. >> >> To prevent this, we check whether we are about to uncharge the root >> memcg and skip it if we are. Possibly instead; the obj_cgroups should >> be removed from their slabs and any per cpu stocks instead of >> reparenting them to root? > > It would be really complex. I think your fix is totally fine. > We have similar checks in cancel_charge(), uncharge_batch(), > mem_cgroup_swapout(), mem_cgroup_uncharge_swap() etc. > > > Acked-by: Roman Gushchin > > Thanks! Great I will respin. -- Thank you, Richard.