Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2024931ybz; Thu, 30 Apr 2020 09:31:44 -0700 (PDT) X-Google-Smtp-Source: APiQypICb7dzU+O2kHdO3Qs9Il+wGDrIvHbniUQVJk4ITCDI2KK9e7vKNvwt1xJaX6TRXHc4bxrp X-Received: by 2002:a05:6402:1515:: with SMTP id f21mr3587669edw.370.1588264303864; Thu, 30 Apr 2020 09:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588264303; cv=none; d=google.com; s=arc-20160816; b=IM+9CGdfn0i3lReMH8eZFInlcpsoCWu6chZjCX3ycw75cVxLgmAf+l5TESf8M+JGgd /GQsUBijeIvTFC+3wXemcKQuf07dPvqhkod74Ge6Fh8FRejj9QS5riV/YRCqHdEMVeGz WXtri4hY0sRkvlS9x1l/xYY03hwdtIKQSvcKtvKRVDzGJ7r/10BF7SRFKkqpkEthGVBB UdBRFvp1daeuidev+eNYBel5UoKCmNv4mparF8CQ5E0VJ2pbe/Zx5Ki47FsfVpVR8ikc s+TsKnsIIZoO5KFk6eIEYkhJ0MQup6ZPjgGDZ/V3vy6vY4gpKa6WPQHtHns6IDt33UV+ 90/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=wRnVQlZFED2GHzfTEJIhf5lAJpjLqPG87MGPuWw4VRU=; b=LIp39THY1tLWOpaqldFAGQq7I1DRVX88fpqm5uWY2xg5nQTef+IGOJSAFpaqRsKp8a 1ND4+nq1nLCwc7+FVdUuuufifuLa8XmiRoFY2RsEm2n2nfDkjI/EbPniEzvBFY4C80z+ PH1Q0wElnTFSsSl4f2w/iHwdp8Sq2k2ixjNuZD/9l76KlZfg71fPj+ChkR1eBFoSAVay jQIwIxTiJ2KPP8U1E7j/o7/26MyhH5CDDZvLjLVyDQNd1peplbyuyhsfJJb4pHZN141L SZ+TI16jLjJwAnb4u0Mp84/l0L2i/G9Iix9hJ4pqBNrmZD+ynZTXlS7VfEOZDQdlr+ia hAKQ== 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 d11si39508edy.477.2020.04.30.09.31.18; Thu, 30 Apr 2020 09:31:43 -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 S1726476AbgD3Q3v (ORCPT + 99 others); Thu, 30 Apr 2020 12:29:51 -0400 Received: from gentwo.org ([3.19.106.255]:55834 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgD3Q3v (ORCPT ); Thu, 30 Apr 2020 12:29:51 -0400 Received: by gentwo.org (Postfix, from userid 1002) id 8B6B13EEE2; Thu, 30 Apr 2020 16:29:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 8A3B03E998; Thu, 30 Apr 2020 16:29:50 +0000 (UTC) Date: Thu, 30 Apr 2020 16:29:50 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Roman Gushchin cc: Andrew Morton , Johannes Weiner , Michal Hocko , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 04/19] mm: slub: implement SLUB version of obj_to_index() In-Reply-To: <20200427164638.GC114719@carbon.DHCP.thefacebook.com> Message-ID: References: <20200422204708.2176080-1-guro@fb.com> <20200422204708.2176080-5-guro@fb.com> <20200423000530.GA63356@carbon.lan> <20200425024625.GA107755@carbon.lan> <20200427164638.GC114719@carbon.DHCP.thefacebook.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Apr 2020, Roman Gushchin wrote: > > Why do you need this? Just slap a pointer to the cgroup as additional > > metadata onto the slab object. Is that not much simpler, safer and faster? > > > > So, the problem is that not all slab objects are accounted, and sometimes > we don't know if advance if they are accounted or not (with the current semantics > of __GFP_ACCOUNT and SLAB_ACCOUNT flags). So we either have to increase > the size of ALL slab objects, either create a pair of slab caches for each size. > > The first option is not that cheap in terms of the memory overhead. Especially > for those who disable cgroups using a boot-time option. If the cgroups are disabled on boot time then you can switch back to the compact version. Otherwise just add a pointer to each object. It will make it consistent and there is not much memory wastage. The problem comes about with the power of 2 caches in the kmalloc array. If one keeps the "natural alignment" instead of going for the normal alignment of slab caches then the alignment will cause a lot of memory wastage and thus the scheme of off slab metadata is likely going to be unavoidable. But I think we are just stacking one bad idea onto another here making things much more complex than they could be. Well at least this justifies all our jobs .... (not mine I am out of work... hehehe)