Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2682765imm; Mon, 24 Sep 2018 08:18:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV60pdGg+0j2JOES0kB/T889I3swvQ6Ze3uvA3BPRbHMjg7u+wNZQKWo294kCAqZ62bVRisnl X-Received: by 2002:a63:141c:: with SMTP id u28-v6mr10063147pgl.247.1537802305833; Mon, 24 Sep 2018 08:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537802305; cv=none; d=google.com; s=arc-20160816; b=yg0zFdpDZeQX4SEPlF3692Ny8HVVVFOtJyjxmVAr6tu76M26nZelNBEiWLdkfqrN+H QitGjpoOdYVFBc4N5vhtU5m2zwEVu1gS9Tn7j1GpW8IxAQdj6n3lxvpmtw+1wc+kz712 kVG5D6Wn0tXJjMkGAqxskkXUTwZC/+8b35A+8XuUGCEc9EKlY9ffvLG41LQVJQYqc5fa CFj7kZKxFln8PeVTRMCnQ8VlJMlzo9Bqs+xvQLLReHKBW0U6gbXdmbdlVr59mvEyx7aT 5TBkH0TFFEbSvkV2eJfG+AJwKEhfZ32Avl+13V/3tFgjXJm05neViEiwSV1kg6gic1TS rwAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=TPkUXeGyOLYRW/ceMziHpBkHJ4ETUn/QdGRFYgFX0/4=; b=kY4QPKfhcJm4okSg6xqgz4oxUBXaafmVhZIbZ5aSb0lZVndwQ10xKGLJKYxCVyeTg6 QqJTveMldCatmJyNgH74pR47AqLUpEhN/tETeJx3HgE3y6q8dp4tBLSRENmqoqaebA+N eS89lGQgUFCAVbxsf5592NvAymjGWI3bsCSNxcnv8fyqpyzESIDnA6wr8CkOBaM85Pe7 jNmyy5++6LRwMuTRFuV7hPYk16/cb4cf5SAZ9+GEORoTE4MYjSj9hkmzJ2XpfbWoWumj Nmb3V2xUsgkudcfKBjOW6bM3Cp7571Owe5pcmjZ87gDuJf9caVzER1/sGNSWEI6lntCz 9kbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b="BeK/oilc"; 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 u1-v6si34428100pgl.669.2018.09.24.08.17.40; Mon, 24 Sep 2018 08:18:25 -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=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b="BeK/oilc"; 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 S1730227AbeIXVT4 (ORCPT + 99 others); Mon, 24 Sep 2018 17:19:56 -0400 Received: from a9-54.smtp-out.amazonses.com ([54.240.9.54]:56082 "EHLO a9-54.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728880AbeIXVT4 (ORCPT ); Mon, 24 Sep 2018 17:19:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1537802236; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=+QBuj6XrdiWV8lRoyI1QXhMT9WgCuArxoRXSkAT50QE=; b=BeK/oilc4LLwaLq3ZvzDm7HaMNAjSQlVF+C3dWRpeh+K32j8NcNk3WmaMkajk5hU fjoeFcARD+neLQ/noYa4Zc0SbaMlC9br8MQ+YOZSIe8BUZcqKj52SqMp53ctMX9Lz8/ vygbtKMl15AcnMQEtk9aGrPUFQOnT8DWH2eX9Wps= Date: Mon, 24 Sep 2018 15:17:16 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Bart Van Assche cc: Andrey Ryabinin , Ming Lei , 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 In-Reply-To: <20a20568-5089-541d-3cee-546e549a0bc8@acm.org> Message-ID: <010001660c27f079-7ba54431-6f0c-430a-8db5-2398a8e761f0-000000@email.amazonses.com> 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> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.09.24-54.240.9.54 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.