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 B4351C433FE for ; Thu, 29 Sep 2022 21:54:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB1BD8D0001; Thu, 29 Sep 2022 17:54:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D61866B0073; Thu, 29 Sep 2022 17:54:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C28648D0001; Thu, 29 Sep 2022 17:54:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B28FF6B0072 for ; Thu, 29 Sep 2022 17:54:57 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8518D1A12AE for ; Thu, 29 Sep 2022 21:54:57 +0000 (UTC) X-FDA: 79966478634.28.5B8CCD6 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) by imf25.hostedemail.com (Postfix) with ESMTP id 3D502A0008 for ; Thu, 29 Sep 2022 21:54:56 +0000 (UTC) Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-131de9fddbaso2355208fac.5 for ; Thu, 29 Sep 2022 14:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date; bh=KbBn8T/FiFSpiieJxniFzc8MGe4ebTJMHKo1Isy1JoI=; b=L7mfDH3G1lyk5WJCFei7+S7tNh5/Iesdoj6VoErYJ9Rx05r27P19zmy5AuUEFzeSLS bA6KfYQtpXTpY0xp4qX7taqNzm+QwUuVPrsXl37x9Z7L3/BWYf8VHvOuRGd/FLd62nKU UeirjlwnaMtuy3FSV4W3+5mNxOqHZQFA7YaATs6xnLp2D7u5KSzWidZzgR5NFby9XfHg CfyOxITj5UZQBz66TFSCQGjcvs+zrABpMmuLZeGjWnOfh15vlu3BpHILlPnDmL/mokg4 tDWjsYalDBw8stJY5Ks07DO9oWc1WmD7J+idkEOx+XP7uqyuIOBdjSgt8KjjQ7STIztY QLSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date; bh=KbBn8T/FiFSpiieJxniFzc8MGe4ebTJMHKo1Isy1JoI=; b=M23NoJVnP+Fgib1zNozgrtC7MENb806u2WJUG3akv19MLx/20O03Fhmc6Q1Rtbyptd KZEI5Ib/CM10m/yU326Rmy1b93ygr0bfoba5oNecQysJHtxrllZWoP2vs8n+UDX9z6/h ssHHOMAPv58XLifcu1in35JX0nnqNe6UizZtO631PXX8BH3R46YFBOX7i1Lvlk3lMJg9 SgCedVy8LMSKKZ8cfigwfUx03+F8a3q1LpDUFmtOqaLLasFfB1EsZPkH960c0ctEAI17 cMcnZYX10vHVF46LeIUKyzA9BRjxnwUpYvTGEgPG3LGJZQmKz5AEcmwE+tC3lThgmlha 6dTw== X-Gm-Message-State: ACrzQf0/pc+AEUFamPrqXJr6sOa7fhKqCdedSD3iLYpN6pyAvuWO/Njc gb7mhppyoDnMhW+FpR+3nCRPdA== X-Google-Smtp-Source: AMsMyM7hB/ryoJJnA/H4js1AjALKInFFXEAwFftQWLIdmXvET8zQ7jPScKLpKZbaIhjBPx6MZlCvDw== X-Received: by 2002:a05:6870:c5a4:b0:131:6edd:3955 with SMTP id ba36-20020a056870c5a400b001316edd3955mr3165338oab.96.1664488495207; Thu, 29 Sep 2022 14:54:55 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id v13-20020a4aa50d000000b004760be682e9sm137347ook.15.2022.09.29.14.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 14:54:54 -0700 (PDT) Date: Thu, 29 Sep 2022 14:54:45 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Vlastimil Babka cc: Hugh Dickins , David Laight , Joel Fernandes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE In-Reply-To: Message-ID: References: <35502bdd-1a78-dea1-6ac3-6ff1bcc073fa@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=L7mfDH3G; spf=pass (imf25.hostedemail.com: domain of hughd@google.com designates 209.85.160.54 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664488496; a=rsa-sha256; cv=none; b=gngcshcbQ5TNor2QjPs3hIgg2k9PrtojwZt0qGAPAcgTPSsDrwyX1OJsaJvAfskPBxlOjz utQAI25Lwde5+jYpcDi9y5/T5lkrdDMfR/MTonMTAhvIF4AILxGjbIoXvHWBVvLkqDO+2M yZAXGRGHavXPuqZ6PsrbIgL2wRv2Wnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664488496; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KbBn8T/FiFSpiieJxniFzc8MGe4ebTJMHKo1Isy1JoI=; b=3tivWq4INBckpqKo3BRgExRygIeXoYf3zOTKlG0HjbtuEAPKFEFBUP4DZv9/mNxVC/K86+ +TFM8VBOmy/TTqjfIHxRj+O3Vw9YQRQ/HaOkv9/TrwcXXkS8XySm1eUH5LTF4PCTaiyyA5 GY6uBnac2w2M2ZjY19xR+g3bJaJapog= X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=L7mfDH3G; spf=pass (imf25.hostedemail.com: domain of hughd@google.com designates 209.85.160.54 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam10 X-Stat-Signature: 8uz5d1e9ho7f9ipn5gdr38qge5em5c48 X-Rspamd-Queue-Id: 3D502A0008 X-HE-Tag: 1664488496-226602 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: On Thu, 29 Sep 2022, Vlastimil Babka wrote: > On 9/28/22 19:50, Hugh Dickins wrote: > > On Wed, 28 Sep 2022, Vlastimil Babka wrote: > >> On 9/28/22 15:48, Joel Fernandes wrote: > >> > On Wed, Sep 28, 2022 at 02:49:02PM +0900, Hyeonggon Yoo wrote: > >> >> On Tue, Sep 27, 2022 at 10:16:35PM -0700, Hugh Dickins wrote: > >> >>> It's a bug in linux-next, but taking me too long to identify which > >> >>> commit is "to blame", so let me throw it over to you without more > >> >>> delay: I think __PageMovable() now needs to check !PageSlab(). > >> > >> When I tried that, the result wasn't really nice: > >> > >> https://lore.kernel.org/all/aec59f53-0e53-1736-5932-25407125d4d4@suse.cz/ > >> > >> And what if there's another conflicting page "type" later. Or the debugging > >> variant of rcu_head in struct page itself. The __PageMovable() is just too > >> fragile. > > > > I don't disagree (and don't really know all the things you're thinking > > of in there). But if it's important to rescue this feature for 6.1, a > > different approach may be the very simple patch below (I met a similar > > issue with OPTIMIZE_FOR_SIZE in i915 a year ago, and just remembered). > > > > But you be the judge of it: (a) I do not know whether rcu_free_slab > > is the only risky address ever stuffed into that field; and (b) I'm > > clueless when it comes to those architectures (powerpc etc) where the > > the address of a function is something different from the address of > > the function (have I conveyed my cluelessness adequately?). > > Thanks a lot Hugh! That's a sufficiently small fix (compared to the other > options) that I'm probably give it one last try. I suddenly worried that you might be waiting on me for a Signed-off-by, which I couldn't give until I researched my reservations (a) and (b): but I'm pleased to see from your kernel.org tree that you've gone ahead and folded it in - thanks. Regarding (a): great, you've found it too, mm/slab.c's kmem_rcu_free() looks like it needs the same __aligned(4) as mm/slub.c's rcu_free_slabi(). Regarding (b): I booted the PowerMac G5 to take a look, and dredged up the relevant phrase "function descriptor" from depths of my memory: I was right to consider that case, but it's not a worry - the first field of a function descriptor structure (on all the architectures I found it) is the function address, so the function descriptor address would be aligned 4 or 8 anyway. Regarding "conflicting" alignment requests: yes, I agree with you, it would have to be a toolchain bug if when asked to align 2 and to align 4, it chose not to align 4. So, no worries at my end now. Hugh