Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3916832iob; Mon, 2 May 2022 08:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy78vGonLwqgpzFGq5uxBqOHITvNuUVr0nNGbnvm8Yn94EGZ0fXm7bEZX4ks+p8o37Kk2AS X-Received: by 2002:a17:902:e84e:b0:15e:583f:8947 with SMTP id t14-20020a170902e84e00b0015e583f8947mr12184418plg.140.1651505998075; Mon, 02 May 2022 08:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651505998; cv=none; d=google.com; s=arc-20160816; b=w2FmarJx0afdnnQG+30vxuCR/0X02x0+33LmY9qpg/t/FaJpgJddXi7t75OUYfIi03 lUKO5p7uGwbxv93gOdIQGPi3LVWHDwDELJOznly5DxmeNH8sAI8cQMhOniB8ef4rcYcl EgAEzJiIlXTf66d7bKjxFl0rRkny5SpmVCyvGfw6ivMSR922JB+PWYsVLyeDQucqIaad Zx66VaGb1c8srui9/abV0XrJXz3dyJsX4QnkyMa1iBzC0G6A5IdGBjprKB5kB5/Ky48w W3WXa9Dw3MzXhXjJOyOxtNzPyN+Rq6BqNE+mM8Jgqh55322zoZ855MqGXK6HhI7sQR1M uqhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zwt1Sx0pGDDP1QIiEEqqtc28lIMUpPSKVSQzvDDcrGM=; b=nE5ESnchemvrkElxWPus28ePphn0ttTmgWAa/D2ObZyleJNEc8bPFHhiXBebBrr9rE WlcXfP3bt2JChAHPw0p4f+vyufvb+uajPFkWYdmeNdRNtoU0YvGGaIUXUt847d/uwUeR yxcuhstybbX61tKH+04Wq7oTewg7ejMXe2Cr7K5xyOfRigIGwakhUhZ2Fwr5mNQuzBnI V8H4ki0GfWJF0sbOWl8s78x1n5pbuLGiHQ414an4xMV8ptrw0CQpMPGaOaFESc3+D4rS JYB4mT1eGZV/6rtlcPBsKeHDRZ3J/1vYpgu5Apr2N5CaBQ2+bd+3jnbmMvMJZqmygkY0 p4Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Mq2yqVxn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a63f415000000b003987eaf156csi14592615pgi.641.2022.05.02.08.39.41; Mon, 02 May 2022 08:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Mq2yqVxn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349770AbiD1QDC (ORCPT + 99 others); Thu, 28 Apr 2022 12:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349735AbiD1QC7 (ORCPT ); Thu, 28 Apr 2022 12:02:59 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3607AADD52 for ; Thu, 28 Apr 2022 08:59:45 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1651161583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zwt1Sx0pGDDP1QIiEEqqtc28lIMUpPSKVSQzvDDcrGM=; b=Mq2yqVxnX5D6a3Z+8iHVLmG47adlPN+nsa+tNRylOKiQ5DMBIoi9QNMIJ6U2jEe08yPZlk R2JK+OjIkZygJjuvdv3k/k5U0iH3M9dwvX618NHg9W6UBlVrFod9G9y7bBZR6lZPWi4VfA KSTFRMbkHn8kXFbU5TNGdZRobG8jaY8= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Peter Collingbourne , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 2/2] mm: slab: fix comment for __assume_kmalloc_alignment Date: Thu, 28 Apr 2022 17:59:40 +0200 Message-Id: <84d8142747230f2015eaf9705ee7c2e1a9f56596.1651161548.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 From: Andrey Konovalov The comment next to the __assume_kmalloc_alignment definition is not precise: kmalloc relies on kmem_cache_alloc, so kmalloc technically returns pointers aligned to both ARCH_KMALLOC_MINALIGN and ARCH_SLAB_MINALIGN, not only to ARCH_KMALLOC_MINALIGN. (See create_kmalloc_cache()->create_boot_cache()->calculate_alignment() for SLAB and SLUB and __do_kmalloc_node() for SLOB.) Clarify the comment. The assumption specified by __assume_kmalloc_alignment is still correct, although it can be made stronger. I'll leave this to a separate patch. Signed-off-by: Andrey Konovalov --- include/linux/slab.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 8cc1d54e56ad..06323a4beff0 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -210,9 +210,9 @@ void kmem_dump_obj(void *object); #endif /* - * kmalloc and friends return ARCH_KMALLOC_MINALIGN aligned - * pointers. kmem_cache_alloc and friends return ARCH_SLAB_MINALIGN - * aligned pointers. + * kmem_cache_alloc and friends return pointers aligned to ARCH_SLAB_MINALIGN. + * kmalloc and friends return pointers aligned to both ARCH_KMALLOC_MINALIGN + * and ARCH_SLAB_MINALIGN, but here we only assume the former alignment. */ #define __assume_kmalloc_alignment __assume_aligned(ARCH_KMALLOC_MINALIGN) #define __assume_slab_alignment __assume_aligned(ARCH_SLAB_MINALIGN) -- 2.25.1