Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp123559oof; Mon, 24 Sep 2018 17:21:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV60QMbul54aq6BNaCbAsZ2cFFbVEADLagR2o2JCP9WnXj0005YZ325pGS1TKLfztrbTKZQzA X-Received: by 2002:a63:66c3:: with SMTP id a186-v6mr935181pgc.330.1537834918756; Mon, 24 Sep 2018 17:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537834918; cv=none; d=google.com; s=arc-20160816; b=kQEXfa9zkD45HVkqK2ohv1QYBMzOI34heHCJT7eqhwOfJKe+s5k+WlEWpxG0/DisIy dkReub4Yu8UhxW5aGYpUPylDZQjUeh/jHrRyriDbIkfl0Ff1aclhgROMfs+IMxvP5/OB /6E40DdE4vFgBUlZeHCZTwAXCDKmxEuwhxDIWv3A6bVFHm9/3V/ho2Lst6Gnkpa0/FbK mjfVDF/Nq7vftoV2pepOAckWG0dVo9XBzPvHqYib9RayuY9Ve3A9UtZEVrABTWhZneIJ o9OI8mJhaokpG376yvdSe5bc7M/7fCoHxqKslCxJuXWsOmK00QDnQSiL+Sq2xze/zIxs M7TQ== 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; bh=CD7/OvH8vAhiKNSq7VQUAyGn2c9qV8ec0EGHTPXEa5I=; b=VYK6NcrEEZHObLHA9r5jGcrBaj3a/LxwPz/lMWI7McEsMf5fdvyHeCcMp+D7wQEp8W FH3KgpIMO7rhs4UFSls93KJcJoKcpFLZEbbLmb0YVY3ffcJadRFpyX302T/u3reeUEHc oON7gm1sBWlKusor73JopeiOW9FnrXW3Jfl5zPUTT2X/gZrzBxC1KJn12yMnGHSs+P6+ kcG/m8ru2CWcRwgZefF9to3IVUzGv6X/tEGbKTwJRn+3wwvWkk5HB0nyGlKdgaCeOq33 x/1Dsw9fC2yDa5Aw0FWZzG1irvFMd82Zy83i/UsQo34pZ0+XFSaW+u4MxiNNisjTcMK2 4eRQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10-v6si752591pgk.392.2018.09.24.17.21.43; Mon, 24 Sep 2018 17:21:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbeIYGZ6 (ORCPT + 99 others); Tue, 25 Sep 2018 02:25:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55530 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbeIYGZ5 (ORCPT ); Tue, 25 Sep 2018 02:25:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C3CE308A963; Tue, 25 Sep 2018 00:21:11 +0000 (UTC) Received: from ming.t460p (ovpn-8-19.pek2.redhat.com [10.72.8.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B788D8379E; Tue, 25 Sep 2018 00:21:02 +0000 (UTC) Date: Tue, 25 Sep 2018 08:20:58 +0800 From: Ming Lei To: Christopher Lameter Cc: Bart Van Assche , Andrey Ryabinin , Vitaly Kuznetsov , Christoph Hellwig , Ming Lei , linux-block , linux-mm , Linux FS Devel , "open list:XFS FILESYSTEM" , Dave Chinner , Linux Kernel Mailing List , Jens Axboe , Linus Torvalds , Greg Kroah-Hartman Subject: Re: block: DMA alignment of IO buffer allocated from slab Message-ID: <20180925002057.GB14386@ming.t460p> References: <20180920063129.GB12913@lst.de> <87h8ij0zot.fsf@vitty.brq.redhat.com> <20180923224206.GA13618@ming.t460p> <38c03920-0fd0-0a39-2a6e-70cd8cb4ef34@virtuozzo.com> <20a20568-5089-541d-3cee-546e549a0bc8@acm.org> <010001660c27f079-7ba54431-6f0c-430a-8db5-2398a8e761f0-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <010001660c27f079-7ba54431-6f0c-430a-8db5-2398a8e761f0-000000@email.amazonses.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 25 Sep 2018 00:21:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 24, 2018 at 03:17:16PM +0000, Christopher Lameter wrote: > On Mon, 24 Sep 2018, Bart Van Assche wrote: > > > /* > > * kmalloc and friends return ARCH_KMALLOC_MINALIGN aligned > > * pointers. kmem_cache_alloc and friends return ARCH_SLAB_MINALIGN > > * aligned pointers. > > */ > > kmalloc alignment is only guaranteed to ARCH_KMALLOC_MINALIGN. That power > of 2 byte caches (without certain options) are aligned to the power of 2 > is due to the nature that these objects are stored in SLUB. Other > allocators may behave different and actually different debug options > result in different alignments. You cannot rely on that. > > ARCH_KMALLOC minalign shows the mininum alignment guarantees. If that is > not sufficient and you do not want to change the arch guarantees then you > can open you own slab cache with kmem_cache_create() where you can specify > different alignment requirements. Christopher, thank you for clarifying the point! Then looks it should be reasonable for XFS to switch to kmem_cache_create() for addressing this issue. Thanks, Ming