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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C915AD6E2DD for ; Wed, 20 Nov 2024 09:13:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 539F76B0085; Wed, 20 Nov 2024 04:13:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E9326B0088; Wed, 20 Nov 2024 04:13:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 388E36B0089; Wed, 20 Nov 2024 04:13:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 049546B0085 for ; Wed, 20 Nov 2024 04:13:32 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DF7B41A0B52 for ; Wed, 20 Nov 2024 09:07:58 +0000 (UTC) X-FDA: 82805892666.17.2AF9E32 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf17.hostedemail.com (Postfix) with ESMTP id 75A4C4000B for ; Wed, 20 Nov 2024 09:07:17 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732093610; a=rsa-sha256; cv=none; b=huH0p7kvC1QXSsZrWpkMEwPOd9R/iNAcaxC1qX4IYl4M8Yl0HAbvamhWAAlRPyzXsA7r7U +CP8HuUkpNEnhLIKT953/M1T1oDdLp5mmkr15XHfavbi2oI/57fMrmDWcZ2yNbXl5PBrMI 3VYOiCdgNh/Kk3mU4qiPTg2ghByHSRA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732093610; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tsS8bF/F5AUqhK7npUVaqAml3lEEVVg4X1ZZTc5yMtU=; b=Ju9I1zm8maOnPhb3HMEK4oN7SrE0FB8g+FI0yN1ljtoiZC6nyRibcf+19rZao/Sfk3aKUn jTK89ARkyXB9Tt2H6BiZkoeBXCa+DyFgdta2MLONQjao68KcDNX0N3nd/mPRxxcIlJS1G6 AkcOsMeKj+Qv2RfyGtKdboMQNXvRjFM= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e38b425ce60so582455276.1 for ; Wed, 20 Nov 2024 01:07:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732093674; x=1732698474; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tsS8bF/F5AUqhK7npUVaqAml3lEEVVg4X1ZZTc5yMtU=; b=Cr5ZLVuJvIBQVVLPSzMOaQ6mk0A4Izn+/WIgjhKUUDOLzU0iYx6T8dqXcwP90rokDs +PIpztF6vwzsElScEgivWTNinv4R8FkS8IlD0vwVqAmQ0Y5AaCs6T2nmnL/Hek3upFp1 ohTH6Q1/WSQscrYFrMSq6N7T9yyR1Gc0jC7mASKef2r6ypsRr+eZw0Pyw3H2DkzIKEFK 1xvzceK4iMpibc7Ma7p+FYeGlSZxsKNsB44DpQmEBGCNvNrEEGdtvHIMzeLnPbBymOrU kO7gCbs9GbPvkPs9rIVycZbokxoskeBkGHBpVMI+suGmyLxSa+moQsMLlajW/d7YsDcn gLoA== X-Forwarded-Encrypted: i=1; AJvYcCVsFT7CW0IoH4cz4LiaZs5p04O66OU3NA1cKFTQutdQd0GebDnJ//YHbbPEFLR8q2+2J+KFcUf0tA==@kvack.org X-Gm-Message-State: AOJu0Yxy92i0GT+3hJF24rYBP0tJgl93MIR2FE96QQtLDh6DW4nKdFV+ kDESmv3euus6XZD5ni6hK8lpwh4qWL+HYODQhf+E5HfLFsoNaKjtw6uPHxJX X-Google-Smtp-Source: AGHT+IHGPVSyZ7pH43i4FgIA6dzv8hOQIaB4gyA3bNPtj+HTPg3E4+qrX/DruzVlSLbOD3AGSyjo8w== X-Received: by 2002:a25:ab0f:0:b0:e38:d000:1555 with SMTP id 3f1490d57ef6-e38d000175dmr667492276.4.1732093674480; Wed, 20 Nov 2024 01:07:54 -0800 (PST) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e387e7225ddsm3023258276.4.2024.11.20.01.07.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Nov 2024 01:07:52 -0800 (PST) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6ea5b97e31cso5205297b3.1 for ; Wed, 20 Nov 2024 01:07:52 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVEOCQoNMkyvQEBT5cmmF8GZiKGyRLldEZI/Mb37maMcyDXv/hPV8Rc1hZw8/m1ZfU2mx/CMcXruA==@kvack.org X-Received: by 2002:a05:690c:d09:b0:6ea:86ae:cbc with SMTP id 00721157ae682-6eebc43e770mr16301717b3.13.1732093671951; Wed, 20 Nov 2024 01:07:51 -0800 (PST) MIME-Version: 1.0 References: <20241029152249.667290-1-axboe@kernel.dk> <20241029152249.667290-4-axboe@kernel.dk> <37c588d4-2c32-4aad-a19e-642961f200d7@roeck-us.net> <5a7528c4-4391-4bd9-bbdb-a0247f3c76a9@kernel.dk> <5851cd28-b369-4c09-876c-62c4a47c5982@kernel.dk> <358710e8-a826-46df-9846-5a9e0f7c6851@kernel.dk> <82b97543-ad01-4e42-b79c-12d97c1df194@kernel.dk> <4623f30c-a12e-4ba6-ad99-835764611c67@kernel.dk> <47a16a83-52c7-4779-9ed3-f16ea547b9f0@roeck-us.net> <6c3d73a5-b5ef-455f-92db-e6b96ef22fba@kernel.dk> <8b95a694-ecd4-4b6d-8032-049894dec2c1@suse.cz> In-Reply-To: <8b95a694-ecd4-4b6d-8032-049894dec2c1@suse.cz> From: Geert Uytterhoeven Date: Wed, 20 Nov 2024 10:07:40 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 03/14] io_uring: specify freeptr usage for SLAB_TYPESAFE_BY_RCU io_kiocb cache To: Vlastimil Babka Cc: Jens Axboe , Jann Horn , Guenter Roeck , io-uring@vger.kernel.org, linux-m68k , Christian Brauner , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: 75A4C4000B X-Rspamd-Server: rspam01 X-Stat-Signature: 31wzbguaofzz74efmnrypr6otr7ijjep X-HE-Tag: 1732093637-120167 X-HE-Meta: U2FsdGVkX19yfo0re3q3YJxE3gjnTctFQijUxbr0zjEAuV01h7OjqQEBOZ0EPbtoA/1tl4+gMC6LMbqj2c5yEln8GHoXR8qIbFNH3VAfAYDPlhXhtD38cnV5BfW/M3KSZHoCodjEJ+4RX3Dc9oRqZxTl2Mr2Mo8FwLF4A8bRTn20FZZST1Bzq4qB4IQO0NoSyAejyvnGIriUQWo7ggvpKcqfZyS/oHRAAlT+x5gpg/ZOgSQI0Lydd7qhbBLeUy6G+bUDiP6Cn+MpdFdCUx4bzwr85NKeiI2WVkrXgka3/FZDNE2ejwl2Ngd9gidMw7GMhTCjcgvnklbtLD6+EBUCbaMqX5ccs3mK7FkgDahVDIKcHhCdVut8yY2puYksWIp4AS/8bka6EzL8xxLspcBAaN0SB+uP6kYbhbawEx3AAkzBQekMLQSMkUcJlIiyKTLV+1Xq0JNXKuzpgeiMkCXZUvRoe7u2HIcEjr1yxpnbHWfaALZOjo71aDc3ZXyQz276nW2DLBMqTZUFnO7xGl1VctxQ/jAuOUvMZ0jKQDhGQOZBc2WQPqXGZ2wLdKc+Tqnr8cYOhy98YkBss63TyeQm3bwuy97H7mE9mSLUO+/Pva8IIi/sNgYsql992CwTUVM7fE/MxSkSsfTrdqecu5W4ySQLJVmBLW27bhVJob5NGi2aGizzz3vLY0iOEU8mfiaoBjTH+U4EZPusNznJCP4bECgQhzryP5BXDkM4UpRFQNN2tQAzSud09DomzmjW2n2H06paW8NIq4SD+v/jUs4wmIUJoKawn/fBFMeCoQG88zcuUMR/ns2efKLVsLbkCsoabZYSbK/CaysKQmMVB8pAhCkr4Qf2Wun+c5qZDLS3ik06IU0AWoID+Rt7OYHoK6xY5GVxl8mQcAaPHYmftH0T7K+YIlf6o6odbMgsaRWB/TnTfAMiIidyJieWXbUNmhLBa+rUtoOi0i7pMG+ZcSQ HIJ2DyOw uLqMCFedxbUG0T/bIyYMzvtuTajk9CJts4T09KyAKISJaWL4Fk5ifjmm/cMnccRy7NJO3QN99yA94egsETSLF2rTsuniLZXBodc6HpHLvBScJB44dyaTiQdZy1ZOHc9tgG3W0dDd4NkHsojKIdrcLpneHInKa1rc6Vkz1Ci3hCiZXu+tE+x8EiR1ag3LIBVmaBuRGWxVHfYHp8Mf+YHArIA8XEZhGamDHFnPd36WvQixTKEjsDSXI1Nl2JPwvzrNuqK+sHInIaBl9Gyr/lvG4969lk9MqXZRvxDXVrLvWr3hQInQDjY0YVY/tyNIEtID+WAAfDnDypaEdc7k72AWGPVs3hyGaSq5MEqcCbfZgkt91DIBAgukMwppf07ogA8zKpwiUPE0HHBmAU02oVX3U6K7KxxGgBpds7onpZesNb9H3kSpEa1n6xQ7ggE/jjH5pdkSCxZHgqmltrZMGPIrUrXMysDRaXNnpYxxtBRs7YM/GoOHHy4jIY8DQCkLCj4CUWlJtqnAqPijzp7GOWNrkEq6SZO2KSxMWkVFY/ft8VRjUIhoyY7vT5sQwuAIMwx5ENxhq X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Vlastimil, On Wed, Nov 20, 2024 at 9:47=E2=80=AFAM Vlastimil Babka wr= ote: > On 11/20/24 09:19, Geert Uytterhoeven wrote: > > On Tue, Nov 19, 2024 at 11:30=E2=80=AFPM Jens Axboe w= rote: > >> On 11/19/24 2:46 PM, Guenter Roeck wrote: > >> > On 11/19/24 11:49, Jens Axboe wrote: > >> >> On 11/19/24 12:44 PM, Jens Axboe wrote: > >> >>>> On Tue, Nov 19, 2024 at 8:30?PM Jens Axboe wrot= e: > >> >>>>> On 11/19/24 12:25 PM, Geert Uytterhoeven wrote: > >> >>>>>> On Tue, Nov 19, 2024 at 8:10?PM Jens Axboe wr= ote: > >> >>>>>>> On 11/19/24 12:02 PM, Geert Uytterhoeven wrote: > >> >>>>>>>> On Tue, Nov 19, 2024 at 8:00?PM Jens Axboe = wrote: > >> >>>>>>>>> On 11/19/24 10:49 AM, Geert Uytterhoeven wrote: > >> >>>>>>>>>> On Tue, Nov 19, 2024 at 5:21?PM Guenter Roeck wrote: > >> >>>>>>>>>>> On 11/19/24 08:02, Jens Axboe wrote: > >> >>>>>>>>>>>> On 11/19/24 8:36 AM, Guenter Roeck wrote: > >> >>>>>>>>>>>>> On Tue, Oct 29, 2024 at 09:16:32AM -0600, Jens Axboe wro= te: > >> >>>>>>>>>>>>>> Doesn't matter right now as there's still some bytes le= ft for it, but > >> >>>>>>>>>>>>>> let's prepare for the io_kiocb potentially growing and = add a specific > >> >>>>>>>>>>>>>> freeptr offset for it. > >> >>>>>>>>>>>>>> > >> >>>>>>>>>>>>>> Signed-off-by: Jens Axboe > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> This patch triggers: > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> Kernel panic - not syncing: __kmem_cache_create_args: Fa= iled to create slab 'io_kiocb'. Error -22 > >> >>>>>>>>>>>>> CPU: 0 UID: 0 PID: 1 Comm: swapper Not tainted 6.12.0-ma= c-00971-g158f238aa69d #1 > >> >>>>>>>>>>>>> Stack from 00c63e5c: > >> >>>>>>>>>>>>> 00c63e5c 00612c1c 00612c1c 00000300 00000001 0= 05f3ce6 004b9044 00612c1c > >> >>>>>>>>>>>>> 004ae21e 00000310 000000b6 005f3ce6 005f3ce6 f= fffffea ffffffea 00797244 > >> >>>>>>>>>>>>> 00c63f20 000c6974 005ee588 004c9051 005f3ce6 f= fffffea 000000a5 00c614a0 > >> >>>>>>>>>>>>> 004a72c2 0002cb62 000c675e 004adb58 0076f28a 0= 05f3ce6 000000b6 00c63ef4 > >> >>>>>>>>>>>>> 00000310 00c63ef4 00000000 00000016 0076f23e 0= 0c63f4c 00000010 00000004 > >> >>>>>>>>>>>>> 00000038 0000009a 01000000 00000000 00000000 0= 0000000 000020e0 0076f23e > >> >>>>>>>>>>>>> Call Trace: [<004b9044>] dump_stack+0xc/0x10 > >> >>>>>>>>>>>>> [<004ae21e>] panic+0xc4/0x252 > >> >>>>>>>>>>>>> [<000c6974>] __kmem_cache_create_args+0x216/0x26c > >> >>>>>>>>>>>>> [<004a72c2>] strcpy+0x0/0x1c > >> >>>>>>>>>>>>> [<0002cb62>] parse_args+0x0/0x1f2 > >> >>>>>>>>>>>>> [<000c675e>] __kmem_cache_create_args+0x0/0x26c > >> >>>>>>>>>>>>> [<004adb58>] memset+0x0/0x8c > >> >>>>>>>>>>>>> [<0076f28a>] io_uring_init+0x4c/0xca > >> >>>>>>>>>>>>> [<0076f23e>] io_uring_init+0x0/0xca > >> >>>>>>>>>>>>> [<000020e0>] do_one_initcall+0x32/0x192 > >> >>>>>>>>>>>>> [<0076f23e>] io_uring_init+0x0/0xca > >> >>>>>>>>>>>>> [<0000211c>] do_one_initcall+0x6e/0x192 > >> >>>>>>>>>>>>> [<004a72c2>] strcpy+0x0/0x1c > >> >>>>>>>>>>>>> [<0002cb62>] parse_args+0x0/0x1f2 > >> >>>>>>>>>>>>> [<000020ae>] do_one_initcall+0x0/0x192 > >> >>>>>>>>>>>>> [<0075c4e2>] kernel_init_freeable+0x1a0/0x1a4 > >> >>>>>>>>>>>>> [<0076f23e>] io_uring_init+0x0/0xca > >> >>>>>>>>>>>>> [<004b911a>] kernel_init+0x0/0xec > >> >>>>>>>>>>>>> [<004b912e>] kernel_init+0x14/0xec > >> >>>>>>>>>>>>> [<004b911a>] kernel_init+0x0/0xec > >> >>>>>>>>>>>>> [<0000252c>] ret_from_kernel_thread+0xc/0x14 > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> when trying to boot the m68k:q800 machine in qemu. > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> An added debug message in create_cache() shows the reaso= n: > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> #### freeptr_offset=3D154 object_size=3D182 flags=3D0x31= 0 aligned=3D0 sizeof(freeptr_t)=3D4 > >> >>>>>>>>>>>>> > >> >>>>>>>>>>>>> freeptr_offset would need to be 4-byte aligned but that = is not the > >> >>>>>>>>>>>>> case on m68k. > >> >>>>>>>>>>>> > >> >>>>>>>>>>>> Why is ->work 2-byte aligned to begin with on m68k?! > >> >>>>>>>>>>> > >> >>>>>>>>>>> My understanding is that m68k does not align pointers. > >> >>>>>>>>>> > >> >>>>>>>>>> The minimum alignment for multi-byte integral values on m68= k is > >> >>>>>>>>>> 2 bytes. > >> >>>>>>>>>> > >> >>>>>>>>>> See also the comment at > >> >>>>>>>>>> https://elixir.bootlin.com/linux/v6.12/source/include/linux= /maple_tree.h#L46 > >> >>>>>>>>> > >> >>>>>>>>> Maybe it's time we put m68k to bed? :-) > >> >>>>>>>>> > >> >>>>>>>>> We can add a forced alignment ->work to be 4 bytes, won't ch= ange > >> >>>>>>>>> anything on anything remotely current. But does feel pretty = hacky to > >> >>>>>>>>> need to align based on some ancient thing. > >> >>>>>>>> > >> >>>>>>>> Why does freeptr_offset need to be 4-byte aligned? > >> >>>>>>> > >> >>>>>>> Didn't check, but it's slab/slub complaining using a 2-byte al= igned > >> >>>>>>> address for the free pointer offset. It's explicitly checking: > >> >>>>>>> > >> >>>>>>> /* If a custom freelist pointer is requested make sur= e it's sane. */ > >> >>>>>>> err =3D -EINVAL; > >> >>>>>>> if (args->use_freeptr_offset && > >> >>>>>>> (args->freeptr_offset >=3D object_size || > >> >>>>>>> !(flags & SLAB_TYPESAFE_BY_RCU) || > >> >>>>>>> !IS_ALIGNED(args->freeptr_offset, sizeof(freeptr= _t)))) > > ^^^^^^ > > > >> >>>>>>> goto out; > >> >>>>>> > >> >>>>>> It is not guaranteed that alignof(freeptr_t) >=3D sizeof(freept= r_t) > >> >>>>>> (free_ptr is sort of a long). If freeptr_offset must be a multi= ple of > >> >>>>>> 4 or 8 bytes, > >> >>>>>> the code that assigns it must make sure that is true. > >> >>>>> > >> >>>>> Right, this is what the email is about... > >> >>>>> > >> >>>>>> I guess this is the code in fs/file_table.c: > >> >>>>>> > >> >>>>>> .freeptr_offset =3D offsetof(struct file, f_freeptr), > >> >>>>>> > >> >>>>>> which references: > >> >>>>>> > >> >>>>>> include/linux/fs.h: freeptr_t f_fr= eeptr; > >> >>>>>> > >> >>>>>> I guess the simplest solution is to add an __aligned(sizeof(fre= eptr_t)) > >> >>>>>> (or __aligned(sizeof(long)) to the definition of freeptr_t: > >> >>>>>> > >> >>>>>> include/linux/slab.h:typedef struct { unsigned long v; } f= reeptr_t; > >> >>>>> > >> >>>>> It's not, it's struct io_kiocb->work, as per the stack trace in = this > >> >>>>> email. > >> >>>> > >> >>>> Sorry, I was falling out of thin air into this thread... > >> >>>> > >> >>>> linux-next/master:io_uring/io_uring.c: .freeptr_offset = =3D > >> >>>> offsetof(struct io_kiocb, work), > >> >>>> linux-next/master:io_uring/io_uring.c: .use_freeptr_offs= et =3D true, > >> >>>> > >> >>>> Apparently io_kiocb.work is of type struct io_wq_work, not freept= r_t? > >> >>>> Isn't that a bit error-prone, as the slab core code expects a fre= eptr_t? > >> >>> > >> >>> It just needs the space, should not matter otherwise. But may as w= ell > >> >>> just add the union and align the freeptr so it stop complaining on= m68k. > >> >> > >> >> Ala the below, perhaps alignment takes care of itself then? > >> > > >> > No, that doesn't work (I tried), at least not on its own, because th= e pointer > >> > is still unaligned on m68k. > >> > >> Yeah we'll likely need to force it. The below should work, I pressume? > >> Feels pretty odd to have to align it to the size of it, when that shou= ld > >> naturally occur... Crusty legacy archs. > >> > >> diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_t= ypes.h > >> index 593c10a02144..8ed9c6923668 100644 > >> --- a/include/linux/io_uring_types.h > >> +++ b/include/linux/io_uring_types.h > >> @@ -674,7 +674,11 @@ struct io_kiocb { > >> struct io_kiocb *link; > >> /* custom credentials, valid IFF REQ_F_CREDS is set */ > >> const struct cred *creds; > >> - struct io_wq_work work; > >> + > >> + union { > >> + struct io_wq_work work; > >> + freeptr_t freeptr __aligned(sizeof(freep= tr_t)); > > > > I'd rather add the __aligned() to the definition of freeptr_t, so it > > applies to all (future) users. > > > > But my main question stays: why is the slab code checking > > IS_ALIGNED(args->freeptr_offset, sizeof(freeptr_t)? > > I believe it's to match how SLUB normally calculates the offset if no > explicit one is given, in calculate_sizes(): > > s->offset =3D ALIGN_DOWN(s->object_size / 2, sizeof(void *)); > > Yes there's a sizeof(void *) because freepointer used to be just that and= we > forgot to update this place when freepointer_t was introduced (by Jann in > 44f6a42d49350) for handling CONFIG_SLAB_FREELIST_HARDENED. In > get_freepointer() you can see how there's a cast to a pointer eventually. > > Does m68k have different alignment for pointer and unsigned long or both = are > 2 bytes? Or any other arch, i.e. should get_freepointer be a union with > unsigned long and void * instead? (or it doesn't matter?) The default alignment for int, long, and pointer is 2 on m68k. On CRIS (no longer supported by Linux), it was 1, IIRC. So the union won't make a difference. > > Perhaps that was just intended to be __alignof__ instead of sizeof()? > > Would it do the right thing everywhere, given the explanation above? It depends. Does anything rely on the offset being a multiple of (at least) 4? E.g. does anything counts in multiples of longs (hi BCPL! ;-), or are the 2 LSB used for a special purpose? (cfr. maple_tree, which uses bit 0 (https://elixir.bootlin.com/linux/v6.12/source/include/linux/maple_tr= ee.h#L46)? Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds