Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp681962pxy; Wed, 5 May 2021 11:07:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZHBO7lHpX9GxeAUJkNJ1aBLDyxgHOeiw+49Y5s8mumC7UfUdiFgpolo0nAUnW0CFdXwQk X-Received: by 2002:a17:906:4d07:: with SMTP id r7mr49259eju.224.1620238056780; Wed, 05 May 2021 11:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620238056; cv=none; d=google.com; s=arc-20160816; b=S168XQ9m+ChydnUjnPSIKeeJRwbX9lUMe/P/4mn5ecw0k4dDWxwm1MfsUWwjvuXvmi iQuAFA2lseAvFlhBvm5tCybTvY17Zgz022DdySrOUwFBmFTB2VcnhSdD6cBdaZo0rDue kXbeOY6sdk9h3Jvt0bbcGwPll0By7CcYfLjwW6kNbthrJz/58KD4pEGAuFp8Mlpx0hhK VPJ2gGPND3sIJlQlarveIdtvOgTbX+pZ27eKSjECWfOfRsCmWtGR8EjPuEy9jw5XwY/X 1SzA2q1u6tx4bhcm5YQ3RwMRyIYzlqyndjOgPXGd4mvlyPeAuEBYrEo9lJAbU5tJOIUT w1Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=+92leeGoaI3r09hH+2EznX9AOzQuz9Mrg1zrkx/zAYE=; b=fAixC7I5uZYO/2Sb1KwZfmFxkein4aPHIa+swSpSQG3Sd2ZMwMfvjRJcKWh8fvBZFG PKWFwv6+fUe+ISNM1usgwzSeMQunIQWnKiMpyqrnZ2h7OgwRZF9tIv6LqzydFSjxN1WU tiIJBDobRgaTn8ktOwl8RF0Yipb8cjH0KaT3XPFrUjv35Iufc/mTW/hcMZiMGvaxPeER 1c1jOUZsPiUzgS1euTRrerylbWvqjfxneJvsNVV3eI/HkuDPCwbvUd2UV+3F1LrwQpq/ ztx9jNyaqwqS/LcC84oH2L5YDbMjdUvFDJpseBiOskxUYGJUgnaMK+tDNCXE62G872b2 TN2Q== 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 cw1si62326ejb.544.2021.05.05.11.07.13; Wed, 05 May 2021 11:07:36 -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 S235469AbhEESDe (ORCPT + 99 others); Wed, 5 May 2021 14:03:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:33502 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235595AbhEESDF (ORCPT ); Wed, 5 May 2021 14:03:05 -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 7DE35B27A; Wed, 5 May 2021 18:02:07 +0000 (UTC) To: Roman Gushchin , Waiman Long Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Shakeel Butt , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org References: <20210505154613.17214-1-longman@redhat.com> <20210505154613.17214-3-longman@redhat.com> From: Vlastimil Babka Subject: Re: [PATCH v3 2/2] mm: memcg/slab: Create a new set of kmalloc-cg- caches Message-ID: <235f45b4-2d99-f32d-ac2b-18b59fea5a25@suse.cz> Date: Wed, 5 May 2021 20:02:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/5/21 7:30 PM, Roman Gushchin wrote: > On Wed, May 05, 2021 at 11:46:13AM -0400, Waiman Long wrote: >> >> With this change, all the objcg pointer array objects will come from >> KMALLOC_NORMAL caches which won't have their objcg pointer arrays. So >> both the recursive kfree() problem and non-freeable slab problem are >> gone. Since both the KMALLOC_NORMAL and KMALLOC_CGROUP caches no longer >> have mixed accounted and unaccounted objects, this will slightly reduce >> the number of objcg pointer arrays that need to be allocated and save >> a bit of memory. > > Unfortunately the positive effect of this change will be likely > reversed by a lower utilization due to a larger number of caches. > > Btw, I wonder if we also need a change in the slab caches merging procedure? > KMALLOC_NORMAL caches should not be merged with caches which can potentially > include accounted objects. Good point. But looks like kmalloc* caches are extempt from all merging in create_boot_cache() via s->refcount = -1; /* Exempt from merging for now */ It wouldn't hurt though to create the kmalloc-cg-* caches with SLAB_ACCOUNT flag to prevent accidental merging in case the above is ever removed. It would also better reflect reality, and ensure that the array is allocated immediately with the page, AFAICS.