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=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=unavailable 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 16556C10F13 for ; Tue, 16 Apr 2019 15:38:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7BB8217D7 for ; Tue, 16 Apr 2019 15:38:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="c0EbnDaE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729426AbfDPPiz (ORCPT ); Tue, 16 Apr 2019 11:38:55 -0400 Received: from a9-92.smtp-out.amazonses.com ([54.240.9.92]:37986 "EHLO a9-92.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728028AbfDPPiz (ORCPT ); Tue, 16 Apr 2019 11:38:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1555429134; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=TkFGn3ILZJOMrhJJWyNYT4Envk++7Wre6S8alltMeeY=; b=c0EbnDaEW3zUT6p0YLvxaJaN9q71+L8TwSXqTYicpNStWsmfJLiHz9GBqoKrUXEH B9uClT3C17ecNZWrhw68u/JHJ8Pk+MmBB9rQGjLFhWX5DjFn7EAOtAwBSyLiW/o0Mpe KIuqWKNgNj/Tan5o58Me3mKYhFONWLbQasxaZzrE= Date: Tue, 16 Apr 2019 15:38:54 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Vlastimil Babka cc: James Bottomley , lsf-pc@lists.linux-foundation.org, Linux-FSDevel , linux-mm , linux-block@vger.kernel.org, Michal Hocko , David Rientjes , Pekka Enberg , Joonsoo Kim , Ming Lei , linux-xfs@vger.kernel.org, Christoph Hellwig , Dave Chinner , "Darrick J . Wong" Subject: Re: [LSF/MM TOPIC] guarantee natural alignment for kmalloc()? In-Reply-To: <68385367-8744-50c3-8a81-be3a4637ea80@suse.cz> Message-ID: <0100016a26cd1058-d1ed3b2e-0cca-4e61-8837-79dfeca68682-000000@email.amazonses.com> References: <790b68b7-3689-0ff6-08ae-936728bc6458@suse.cz> <1555053293.3046.4.camel@HansenPartnership.com> <68385367-8744-50c3-8a81-be3a4637ea80@suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2019.04.16-54.240.9.92 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, 12 Apr 2019, Vlastimil Babka wrote: > On 4/12/19 9:14 AM, James Bottomley wrote: > >> In the session I hope to resolve the question whether this is indeed > >> the right thing to do for all kmalloc() users, without an explicit > >> alignment requests, and if it's worth the potentially worse > >> performance/fragmentation it would impose on a hypothetical new slab > >> implementation for which it wouldn't be optimal to split power-of-two > >> sized pages into power-of-two-sized objects (or whether there are any > >> other downsides). > > > > I think so. The question is how aligned? explicit flushing arch's > > definitely need at least cache line alignment when using kmalloc for > > I/O and if allocations cross cache lines they have serious coherency > > problems. The question of how much more aligned than this is > > interesting ... I've got to say that the power of two allocator implies > > same alignment as size and we seem to keep growing use cases that > > assume this. Well that can be controlled on a per arch level through KMALLOC_MIN_ALIGN already. There are architectues that align to cache line boundaries. However you sometimes have hardware with ridiculous large cache line length configurations like VSMP with 4k. > Right, by "natural alignment" I meant exactly that - align to size for > power-of-two sizes. Well for which sizes? Double word till PAGE_SIZE? This gets us into weird and difficult to comprehend rules for how objects are aligned. Or do we start on the cache line size to provide cacheline alignment and do word alignment before? Consistency is important I think and if you want something different then you need to say so in one way or another. > > I'm not so keen on growing a separate API unless there's > > a really useful mm efficiency in breaking the kmalloc alignment > > assumptions. > > I'd argue there's not.