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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7188BC433EF for ; Mon, 11 Apr 2022 10:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NnhpnKSD8DuRy6sW7qKV7aJcX1ILsqOHY4PZAtvMWaY=; b=uuf9OM/L5mNmrW qkQDRgB5x2+dXTDuj/Sta7tN2qnZAEpWWuaNQbwhovCAdzUek6hlYoqvF3d7asm6QiARSqzspJJ9p 8w9e6e1QJv98QalUvsSB9OmPEmUYvzjnQIEi/qLhD+BWdzYG/S2wOgbkgMukt5pufpLZrHplke7gu JTTr+eTmzkYeVp0LXrUTaQR2xnaj1oL9ehqqqb9PxPB/wfWKR6Qompf3ZYsUQ+fEKGukbkWzvPjma yDCwrieUJP6cS0J2ikpL9AAhgoYPBmy5YcSJkz5Ino8e36kw2DQZcoRAw6I9LsZQziDqWZYCHxS/X FZ5LHUL3hknUCgJJAa2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndrWW-008Rxg-M0; Mon, 11 Apr 2022 10:43:57 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndrQ1-008OrO-JV for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2022 10:37:21 +0000 Received: by mail-pj1-x102d.google.com with SMTP id a16-20020a17090a6d9000b001c7d6c1bb13so16354963pjk.4 for ; Mon, 11 Apr 2022 03:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sZ5r1Ulc6PwR+ueUKNqo2D8Zab24hQBuwaMfaw8Ofy0=; b=fc64tTXnjyhGNHfV0GQvoJYJRlkNoJju8a2bH+jOoLii9ffVQ8PzR/409RWEPd58II Ek2BaGkvbWWG3Dw/wkeS1D05l/BsPuJEzMzoSbPc8SJO7Aw883hKMKBzKisAlyJnTEzs UiG2jiyOxLVxmq+27F/+elTgNuy1YVxDl/EM8uAaMoMMhffcgfzUqnd4qFDkG0FXJcOm O2E7nImZ1DyCt9tIzxYaihygWUNomywo32J1THuGi+d5Oer13kkHMeVg2We6ou4FibWO yDmDW0KXvOduGY5DOEkV9WbHK55bBl6zTbAPFmZhQ1xEkKMRXjiT+oxWX6ckWIjAG+sr dAUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sZ5r1Ulc6PwR+ueUKNqo2D8Zab24hQBuwaMfaw8Ofy0=; b=NXUMzh5kZ2EIyH0DcXeZGeCkQW8Nk/aSW0Wbm90OBTrB/K3wMY0H1ywChEo1Mun3II o37A+6jCOt2Wb8rEcl6SoHBOY+475Fbp1U5EXWaLe4GjRApsms1v4WEKTwD5lqqjRrWx QzrKI1sAc+Y3UZAdIUxjO9VePsW3jlRFzE476zmrhcUll3ZFqf25Pr1zasJr35pf4Dau gcqU+aniOjUKYaO5MSjAIUwp5DP9Msb0mh9QgBEc4sxHUrpa1TSCgxuzs1I3Alafv/d6 z2dph9RoiG/JV9Tlw6KyNy/UvGUwBIhTDHJIEMxI93BpJ6CWkukmq9nDa1mYrtYC0nKe czVw== X-Gm-Message-State: AOAM530Z7iESb/XRbPN8f2JWhO8EBp1PrvPoWqubYldg3Ua7OuXpskPf hJDNkqdOiIHGL6EPM/hff9o= X-Google-Smtp-Source: ABdhPJzqE7fdczyeXzyQeDjOMudzBySH+60ePuOE2mP9NT+DcGJhwjaFeRriNyLNylES+uJmxSfCIw== X-Received: by 2002:a17:902:bd89:b0:156:8467:782b with SMTP id q9-20020a170902bd8900b001568467782bmr31684434pls.12.1649673429936; Mon, 11 Apr 2022 03:37:09 -0700 (PDT) Received: from hyeyoo ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id x39-20020a056a0018a700b004fa7e6ceafesm35865007pfh.169.2022.04.11.03.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 03:37:08 -0700 (PDT) Date: Mon, 11 Apr 2022 19:37:01 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Catalin Marinas Cc: Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/10] mm/slab: Decouple ARCH_KMALLOC_MINALIGN from ARCH_DMA_MINALIGN Message-ID: References: <20220405135758.774016-1-catalin.marinas@arm.com> <20220405135758.774016-2-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220405135758.774016-2-catalin.marinas@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220411_033713_697281_745AB5A3 X-CRM114-Status: GOOD ( 24.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 05, 2022 at 02:57:49PM +0100, Catalin Marinas wrote: > In preparation for supporting a dynamic kmalloc() minimum alignment, > allow architectures to define ARCH_KMALLOC_MINALIGN independently of > ARCH_DMA_MINALIGN. In addition, always define ARCH_DMA_MINALIGN even if > an architecture does not override it. > > After this patch, ARCH_DMA_MINALIGN is expected to be used in static > alignment annotations and defined by an architecture to be the maximum > alignment for all supported configurations/SoCs in a single Image. > ARCH_KMALLOC_MINALIGN, if different, is the minimum alignment guaranteed > by kmalloc(). > > Signed-off-by: Catalin Marinas > Cc: Andrew Morton > --- > include/linux/slab.h | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 373b3ef99f4e..d58211bdeceb 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -187,17 +187,30 @@ bool kmem_valid_obj(void *object); > void kmem_dump_obj(void *object); > #endif > > +/* > + * slob does not support independent control of ARCH_KMALLOC_MINALIGN and > + * ARCH_DMA_MINALIGN. > + */ > +#ifdef CONFIG_SLOB > +#undef ARCH_KMALLOC_MINALIGN > +#endif > + > /* > * Some archs want to perform DMA into kmalloc caches and need a guaranteed > * alignment larger than the alignment of a 64-bit integer. > - * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that. > + * Setting ARCH_DMA_MINALIGN in arch headers allows that. > */ > -#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8 > +#ifndef ARCH_DMA_MINALIGN > +#define ARCH_DMA_MINALIGN __alignof__(unsigned long long) > +#elif ARCH_DMA_MINALIGN > 8 && !defined(ARCH_KMALLOC_MINALIGN) > #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN > -#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN > -#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN) > -#else > +#endif > + > +#ifndef ARCH_KMALLOC_MINALIGN > #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) > +#else > +#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN > +#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) > #endif > > /* > Sorry for the noise I made due to misunderstanding :) Now this patch looks good to me and I think it's worth adding. Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> and works fine with SLAB/SLOB/SLUB on my arm64 machine. Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thanks! -- Thanks, Hyeonggon _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel