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 165A6C433EF for ; Fri, 8 Apr 2022 09:08:23 +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=JV3PgxhI1eEE8tCPEJrS3olReVLcWt/Wc4lA25dqQwA=; b=Ozrrobq+mYzhAb dTSUHmcVy4brd/ua3sA9v+LPCsDvr+ABQWokGqA3MqCcxPVUgVQATnyn5EHnepWCPNbKXYpC68eYF VyRxf3DvmlqVVzO4U6pEvlpE/0kIbOzQ28T72lJcn8Om1N8seNT8/OoZUs0UgkYP3+tnUp842JF7A kP/pb1dcMED0V7yEXLXMCu0DsQ19V8HDEO2r6Ybbz7+Rp633LsvAhKZEsuCqbB7umOzeUAHnE/ho/ 7hUuVBbzRN8EDiBNopwhl10h2zZ8dGoZO/k915P9WJJiMCFl4kRFttGZkTlxKXxURMmfhTQXESEUp /S5+qYsIVdEAvYThmNlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nckaJ-00G3VP-48; Fri, 08 Apr 2022 09:07:15 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nckaE-00G3Po-3I for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 09:07:11 +0000 Received: by mail-pl1-x630.google.com with SMTP id m16so7359404plx.3 for ; Fri, 08 Apr 2022 02:07:07 -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=hp7oYdsS7Bs34J2va/oMNBikxIZxJ90vFNDe63jTHPc=; b=TgIcmPCUaDGf5BULFOSeUI5lFTbyU4OYkADhgfOVmNlBAMQ8R+47hSDSezENWBsISy 98s+Uomdrhqqgkai8K8sh/RTwR+cSuQMYT69WSrf8N7uEzsF9gYqFu5ryH1GCBgZzLIj 1VJHhEOLlZUl/nWwDnt9CSyFpm275Q+MOtezxZhJWvCkpOnaBh2y+HbFWI5iGzDOjQFx NidhzW+cL5E9bBDt61BTI2NcpYw74P1/QLO6qZt4fQGNn+oBfn3dmiEfl7mVKNIfSo7s qVXPYfMHxZ8G8IinzssHL9KQwxqhvoC5LabWF7OxHzJygVGRTR1F4c9d1Y34I6JT9eyE u+oQ== 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=hp7oYdsS7Bs34J2va/oMNBikxIZxJ90vFNDe63jTHPc=; b=u4xiuplnRUDRRSV9/LLliB/IyOcMjYP2cEv9v4GhJ+vuME5bcZbMTKeE8MDKD6JNTv dDBKHum9nyj3u5jmn68yTmNMsL0/ET1pkHVZZV8Y79ooQpcX7ZNf+rC4YfSwwkaRI8c8 nS5RzMcewXwfrygVnoPzQMJaIpD2ZbvfZTcG0WMoV6vY3W5C7aNkRd+yHHrpfPM7hwC9 6pWxIkGgYt3XDMGSSbmHKR/FKndV/H0E7AM4180ahomYsZGA5Szx9jQNSR+TuCrEGCYB /xPI7+VGN6zpwbOtge1nCZAQKZ7U0/0W3f9GMBLL8i9AEkXoidpuflIRK1qW3MKJsu0r tk5A== X-Gm-Message-State: AOAM533Bti5qx7QwPGFgflRxAx3rtW3A+3n2y5GI+w2f8q8QXO8dxICT 3gj5q6FhhP7ksWsmQPbAHw8= X-Google-Smtp-Source: ABdhPJy91dsjCOSU1aXFqQra3/IuGWyEESqAOb9Od7Z2fXTT7pJzE9WcTnmSxGLrPprsHZJgcnh2mQ== X-Received: by 2002:a17:90b:4b43:b0:1c9:85b0:2db8 with SMTP id mi3-20020a17090b4b4300b001c985b02db8mr20542501pjb.23.1649408826983; Fri, 08 Apr 2022 02:07:06 -0700 (PDT) Received: from hyeyoo ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id y30-20020a056a001c9e00b004fa9246adcbsm24075496pfw.144.2022.04.08.02.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 02:07:05 -0700 (PDT) Date: Fri, 8 Apr 2022 18:06:58 +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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_020710_212269_E1AE8C56 X-CRM114-Status: GOOD ( 30.75 ) 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 Fri, Apr 08, 2022 at 03:42:13PM +0900, Hyeonggon Yoo wrote: > 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 > Sorry for the noise. Yeah, the code above is making ARCH_KMALLOC_MINALIGN = ARCH_DMA_MINALIGN. I was confused :( > I think you should replace ARCH_KMALLOC_MINALIGN with ARCH_DMA_MINALIGN > in mm/slob.c too? Or detect minimum kmalloc alignment in runtime like SLAB/SLUB? > > current code seem to break with SLOB on machines that has 128 byte cache lines > because ARCH_KMALLOC_MINALIGN is 64? > > > + > > /* > > * 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 > > > > /* > > > > -- > Thanks, > Hyeonggon -- Thanks, Hyeonggon _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel