Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp40838pxb; Tue, 12 Apr 2022 16:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz863O4BWO/O/bkk7+bMcemP1uQ0PAv3Rztu3PDLd0ALfJfgv8Cx7TM/S7w697CyrcUvWbx X-Received: by 2002:a17:902:8d83:b0:157:c14:12b5 with SMTP id v3-20020a1709028d8300b001570c1412b5mr27913893plo.91.1649805168254; Tue, 12 Apr 2022 16:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649805168; cv=none; d=google.com; s=arc-20160816; b=OWXIV5SoKPfXkZUDnZnwm2AQakoUa3/Tt7ezsk/VznvF4g6QWKGUtFJ585rWTGn1wS EUkgY6jMJJznUFL+UTkFp+35NvJ/fsC3LiJMOgkxj+Gq62aUHfmPwF43etrzuye+NVzU hfV4yKNQoCk7IiwvP/jcx2ekEMI6xUXXZwNPl/xSQEUFwfXZRF+ZMxrZopYW9jkyUfHz EstXVlz7p/j90/ANwEVgt5SveQ9YCBdLh/FxF7UugvoGRzlNF+z/1br0nTAg8fk39LDK MhmUoKmBrPvLuNfMqbzX05jo/eZmcnUBkmkd7W0nCzYc60BjkVaDnSyYcU0PEM6A5F/N ep/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sZ5r1Ulc6PwR+ueUKNqo2D8Zab24hQBuwaMfaw8Ofy0=; b=reySTzDDFiqsiEuTm5kUUL7WfjNu6ppEalPDIAyOjFQqZ7qVaLJ5LrJtsSfzi4VQeA Hys2p9upWXpo4aD6Zc7lM3dKisTF+wvFcUt9KBnj7K8gLuhyxEjU8CMT3S1ZuupVPnqE 6JUfMnCY11bO67cRctBGO4BhkL+SEBhA68Dmy8jugpy+UAWLo0+24+pfagRKdwR+9UYv YXdHF/potRWt2ehGcr3upxH73jl46wkiku2R6poUvhvqfIyQ0VTdDoKFws9P+zeNdCVA m1MbTeUqtwsxk9jqZL4eadjS50xuehoCyiLnWfSRjd980iK8uZDleOdXTt1PIksSZ71A +S3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fc64tTXn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e13-20020a170902ed8d00b00153b2d1650bsi12608116plj.275.2022.04.12.16.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:12:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fc64tTXn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 851AA124C03; Tue, 12 Apr 2022 14:55:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345641AbiDKKj0 (ORCPT + 99 others); Mon, 11 Apr 2022 06:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234732AbiDKKjX (ORCPT ); Mon, 11 Apr 2022 06:39:23 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7598A43ECD for ; Mon, 11 Apr 2022 03:37:10 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id 12so1676869pll.12 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=X2UCLf0ogcPp/6vWLJIr9UYEBMlxjINIGOha4Tq2kcBScjKdD16xoUwZKUlw0LtArh regxaK7ndEIszkXYULUEUqCzW7JgJJPwycITyGtR/Edk/QY369yEB7SkTON8PO6HQLH0 sBb16uPQPu0UmUn8Xf3qdAAaepkCnrMGzsRGsEtEJ9ML0wJXhpbI6hGVwByjRaxN/Jir k/yy8HK8eTVEoZBEekbBcE9/PNN3zKG0etUdZRkwyoXD4P9rA2gC/eYWl0TN7FGVLdnH 4lUILLyiCzmJc65TMUlm39CgtcgQvXopDFjVfTE4UiEVhdNyhpellU2BLWCGe6ru2Smb HM6Q== X-Gm-Message-State: AOAM531FKbI+C2O/m5K7h970cn012xueXXZrcHV0G6zgwOVFh4nabT83 NS1Lz+8xgpR1ZtwGpBX1Qfw= 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220405135758.774016-2-catalin.marinas@arm.com> X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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