Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6957531ybn; Mon, 30 Sep 2019 06:32:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzT5JUvqoGOdzAfFerHd3i+ZxucdRXyqcN1V0Jg+L7OfXrUuF17asrpTnWmqmsgv2iN76rT X-Received: by 2002:a50:f78a:: with SMTP id h10mr19866732edn.161.1569850359077; Mon, 30 Sep 2019 06:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569850359; cv=none; d=google.com; s=arc-20160816; b=xEd45V6O4CpiKtm4kZbCnDPFTK4ByXQ1kJC5NfPrRymjkRUangRx8H1ZV3iLJhQsfn zcKdT33EuUB0CQHDbE/CuAg37rQSEpEdJ65M4qk5cy1XPBJpqjJc8lhcM1O59q2oAA6D sHQAJUJJOjf119pVlXoYzbKTvbmUAeEw2Pqoxq8ku0oTw69+NgA9H0geq0POBeZ6vuAK 5HXDPU8kN3ckKHQK9hzOhJaONeX4OyMiF8VP6zODWrl7LcTAWIgg/wQjKBgTCoXsxpOl t66B/eAEuQTYleBA/BKZc9duxlgNXoP08CS0Kgk3E/Hl4nB6GnyZoXIAGLue8eH9I0Kg Tibg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jwTg4fslkkXzfCclLjZOgIaOdnKQRQ6WQVeTB5C7GPs=; b=wpaF9To6VfftE6NMdGSF/JukMfuRemTXuxVtVwHELP8ifcDE8Mo2Wo9/PkeBAPGRrp O7SYggbXHuV7+dVbKBUFCqpK++sY+Da8z2C45kiX26O2lQ4+YqjOb4gctevHztFkccfW 9atUUgNvjNo5hepUKURYJa+n0B+IE+LJch5T9/dXBi8EirhUVKt8pvpa5jSm0pKlzWaq Y4Nz1OEaVOTnN3bAAIK3WCTyEY/9IxMJRU0u7af47uMhz8MIm9kpsCAcO4/UwZ4sBico mhKSi6besgZ8OGJQu5Q9e02Aeo1HRcpN39jtqP9IoOiuiGwGs9FCOyRtWJoja8VX6KjO vHKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GTsAp7UQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si6678171edq.391.2019.09.30.06.32.13; Mon, 30 Sep 2019 06:32:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GTsAp7UQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731076AbfI3NcI (ORCPT + 99 others); Mon, 30 Sep 2019 09:32:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52226 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728214AbfI3NcI (ORCPT ); Mon, 30 Sep 2019 09:32:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jwTg4fslkkXzfCclLjZOgIaOdnKQRQ6WQVeTB5C7GPs=; b=GTsAp7UQvIcIvL7TkWfOBSdUl M6EGMhlYfNT8cjQLHe/X55q53qvVOm4qHmblR+q079BsjQ5IJL6GR7NCHXZopzNuDhg6Olt9GWJZf TuWtjBJdrVKCPCz5dV157Ng6PX7X3d2OWKAE5dWwmbqm+fPiwDYPLZRIsGT9W7P5WF0RA/+YKwg1V ZOHTI5PeaKSpRxD64+n/Vso0SEIefZGFuhgMefh1Jc8e4GkOyMi2owWOVqPMkF1L4tFxZx/S6CMm1 CGRE7n3xBfoaoO/5xJs2pNSfHxGZzfESSdFdPlS3AMKKj3NdKP8XJoGmGlhxMVZVMbWyoc+BXXz04 KjNnO/TQQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEvmW-0007wp-1A; Mon, 30 Sep 2019 13:32:04 +0000 Date: Mon, 30 Sep 2019 06:32:03 -0700 From: Matthew Wilcox To: Christopher Lameter Cc: Vlastimil Babka , Andrew Morton , David Sterba , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pekka Enberg , David Rientjes , Ming Lei , Dave Chinner , "Darrick J . Wong" , Christoph Hellwig , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, James Bottomley , linux-btrfs@vger.kernel.org, Roman Gushchin , Johannes Weiner Subject: Re: [PATCH v2 2/2] mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two) Message-ID: <20190930133203.GA26804@bombadil.infradead.org> References: <20190826111627.7505-1-vbabka@suse.cz> <20190826111627.7505-3-vbabka@suse.cz> <20190923171710.GN2751@twin.jikos.cz> <20190924165425.a79a2dafbaf37828a931df2b@linux-foundation.org> <6a28a096-0e65-c7ea-9ca9-f72d68948e10@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 28, 2019 at 01:12:49AM +0000, Christopher Lameter wrote: > However, the layout may be different due to another allocator that prefers > to arrange things differently (SLOB puts multiple objects of different > types in the same page to save memory), if we need to add data to these > objects (debugging info, new metadata about the object, maybe the memcg > pointer, maybe other things that may come up), or other innovative > approaches (such as putting data of different kmem caches that are > commonly used together in the same page to improve locality). If we ever do start putting objects of different sizes that are commonly allocated together in the same page (eg inodes & dentries), then those aren't going to be random kmalloc() allocation; they're going to be special kmem caches that can specify "I don't care about alignment". Also, we haven't done that. We've had a slab allocator for twenty years, and nobody's tried to do that. Maybe the co-allocation would be a net loss (I suspect). Or the gain is too small for the added complexity. Whatever way, this is a strawman. > The cost is an unnecessary petrification of the data layout of the memory > allocators. Yes, it is. And it's a cost I'm willing to pay in order to get the guarantee of alignment.