From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23657C433ED for ; Wed, 5 May 2021 18:02:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 98375613AA for ; Wed, 5 May 2021 18:02:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98375613AA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E55586B006C; Wed, 5 May 2021 14:02:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E04C86B006E; Wed, 5 May 2021 14:02:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA4146B0070; Wed, 5 May 2021 14:02:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0072.hostedemail.com [216.40.44.72]) by kanga.kvack.org (Postfix) with ESMTP id B175D6B006C for ; Wed, 5 May 2021 14:02:09 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 653B8180AD830 for ; Wed, 5 May 2021 18:02:09 +0000 (UTC) X-FDA: 78107946378.15.0DDD86A Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id 03C329000739 for ; Wed, 5 May 2021 18:01:36 +0000 (UTC) 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 X-Rspamd-Queue-Id: 03C329000739 Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam04 X-Stat-Signature: wxgfhs1ra3c5kdzwsixm7oehbm4k9om4 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1620237696-995737 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 5/5/21 7:30 PM, Roman Gushchin wrote: > On Wed, May 05, 2021 at 11:46:13AM -0400, Waiman Long wrote: >>=20 >> 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 longe= r >> have mixed accounted and unaccounted objects, this will slightly reduc= e >> the number of objcg pointer arrays that need to be allocated and save >> a bit of memory. >=20 > Unfortunately the positive effect of this change will be likely > reversed by a lower utilization due to a larger number of caches. >=20 > Btw, I wonder if we also need a change in the slab caches merging proce= dure? > KMALLOC_NORMAL caches should not be merged with caches which can potent= ially > include accounted objects. Good point. But looks like kmalloc* caches are extempt from all merging i= n create_boot_cache() via s->refcount =3D -1; /* Exempt from merging for now */ It wouldn't hurt though to create the kmalloc-cg-* caches with SLAB_ACCOU= NT 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 immediatel= y with the page, AFAICS.