Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp251419img; Wed, 20 Mar 2019 19:24:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxahxScgS1rnUIHSXmdGBkIZt0Z5ccbmF4SqxumaVV61Vh6Wy2k00yGTqXWDxB+tDmeus0D X-Received: by 2002:a17:902:7590:: with SMTP id j16mr1086363pll.304.1553135094698; Wed, 20 Mar 2019 19:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553135094; cv=none; d=google.com; s=arc-20160816; b=a1XBdUJE7oPFUKvfyExXyMmjUSXKor9uzif6bo6KbslCMp6yurq1d1vo0PlVUG8HOB lhm+9KmD+PqVYOlyjrQKcoGVvgs2r1hFeRyEt65tZpMtLJWQXhWlAecJNOBCRnHCINQI z2dKUdyu1RV/6nbi2E8J4DvAKG01CYXF8RjGjQugL7KXqCkXI9LWwBgWy9MCTylxLZkQ wyF1bmwawObVCPLptItzmLxGlcj7bcu3oLTgaHoqom9COQcl0nD/jx2omU6AYzX8JX1P HCu3H0o7bIz5ZMavhwWjgqKqz/uH+Ny7PGvqDXUdgDkg4gq0TCLAm8mxyBwcIYNRzrVT NoTg== 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=VeDSfNZVcKF/dmMd18yaoimKM6Z0qfa8XNDM5mZkkgM=; b=BYdjstgeX0avHOeb3L6buy7owMQ58b6y+GM8x7dF91fBpm7ULDE9msyFoEQRf/NM0T VqWgf+r5lgiyYdOK7A/HUaRPpYC3elqmSEJ4IXmugaFemzR5iE304dk47E0R4qxEsXKg ic6iarfO8tux9QlI6gxu0XXozyvrAZurOWjGMy5cfDyI7jby6Gri+8pKn7wrEaqXAil0 OAy3IzIB4g+84WR1BTRG55H7D5ExmKVb89jGy/5GXe8d3k0bWtzTkRt53kHRJUFWuP+6 EP8gZCKG/vLDigSxoFSzKgZsIkRx4HTc3+W0wsWxb5tojivJ8s5uYQJA4dj24vmHN5MU MQiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="LJBelv/N"; 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 t9si3221628pgc.164.2019.03.20.19.24.39; Wed, 20 Mar 2019 19:24:54 -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="LJBelv/N"; 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 S1727751AbfCUCYF (ORCPT + 99 others); Wed, 20 Mar 2019 22:24:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49340 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbfCUCYE (ORCPT ); Wed, 20 Mar 2019 22:24:04 -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=VeDSfNZVcKF/dmMd18yaoimKM6Z0qfa8XNDM5mZkkgM=; b=LJBelv/NWrJP+46sNa0Z0Cxvm Wfe6QsPQy3cLQeSqK18OOxmRL4ocKWa1kpssRKzWLWThOItpi0fQsmjWau7ObsaO14iFhD8LvPVDV 3TNYfRczHJ52/nnWnMukdEvMXIEtu4gnUhE27YHTjnUzWgAbc3g91Np08MiV5f3DdJJg/7auDFG1u ut2WxSoDVNcb5g0jaANLgtFLRISck2fV34uP/kQae4h9lG4sjmEHpKQjLiJHWC3ujqf+9kYzJUvjH 9uz5Uc+Y+3flPehLFAbvQnp4y0pAZQ6VCBal9pnL7jRGOgoLmT5RO/s8XVy+6rJZykRd5DvwXNAE+ SLUxRCAkg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6nN5-0005Us-Vg; Thu, 21 Mar 2019 02:23:55 +0000 Date: Wed, 20 Mar 2019 19:23:55 -0700 From: Matthew Wilcox To: Vlastimil Babka Cc: Christopher Lameter , linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Ming Lei , Dave Chinner , "Darrick J . Wong" , Christoph Hellwig , Michal Hocko , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [RFC 0/2] guarantee natural alignment for kmalloc() Message-ID: <20190321022355.GA19508@bombadil.infradead.org> References: <20190319211108.15495-1-vbabka@suse.cz> <01000169988d4e34-b4178f68-c390-472b-b62f-a57a4f459a76-000000@email.amazonses.com> <5d7fee9c-1a80-6ac9-ac1d-b1ce05ed27a8@suse.cz> <20190320185347.GZ19508@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 20, 2019 at 10:48:03PM +0100, Vlastimil Babka wrote: > On 3/20/2019 7:53 PM, Matthew Wilcox wrote: > > On Wed, Mar 20, 2019 at 09:48:47AM +0100, Vlastimil Babka wrote: > >> Natural alignment to size is rather well defined, no? Would anyone ever > >> assume a larger one, for what reason? > >> It's now where some make assumptions (even unknowingly) for natural > >> There are two 'odd' sizes 96 and 192, which will keep cacheline size > >> alignment, would anyone really expect more than 64 bytes? > > > > Presumably 96 will keep being aligned to 32 bytes, as aligning 96 to 64 > > just results in 128-byte allocations. > > Well, looks like that's what happens. This is with SLAB, but the alignment > calculations should be common: > > slabinfo - version: 2.1 > # name : tunables : slabdata > kmalloc-96 2611 4896 128 32 1 : tunables 120 60 8 : slabdata 153 153 0 > kmalloc-128 4798 5536 128 32 1 : tunables 120 60 8 : slabdata 173 173 0 Hmm. On my laptop, I see: kmalloc-96 28050 35364 96 42 1 : tunables 0 0 0 : slabdata 842 842 0 That'd take me from 842 * 4k pages to 1105 4k pages -- an extra megabyte of memory. This is running Debian's 4.19 kernel: # CONFIG_SLAB is not set CONFIG_SLUB=y # CONFIG_SLOB is not set CONFIG_SLAB_MERGE_DEFAULT=y CONFIG_SLAB_FREELIST_RANDOM=y CONFIG_SLAB_FREELIST_HARDENED=y CONFIG_SLUB_CPU_PARTIAL=y