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 682CEC4332F for ; Sun, 2 Oct 2022 05:48:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A78F86B0072; Sun, 2 Oct 2022 01:48:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A28F56B0073; Sun, 2 Oct 2022 01:48:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C8F88D0001; Sun, 2 Oct 2022 01:48:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 70BC36B0072 for ; Sun, 2 Oct 2022 01:48:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4278DAAC53 for ; Sun, 2 Oct 2022 05:48:12 +0000 (UTC) X-FDA: 79974928824.29.80A720E Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf20.hostedemail.com (Postfix) with ESMTP id CB1A71C0022 for ; Sun, 2 Oct 2022 05:48:10 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id l12so7261649pjh.2 for ; Sat, 01 Oct 2022 22:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=VgNJ1GE8Vgm6Xrjpg25iYal6CFtq/s9kQyktt7aaKUE=; b=G+Nj6O7uP97vjLNbXj4dcOqlrfn4eMtnO/h4QuV/EibeSN4ZaYQmOTtgl4OtxFWRI0 Nai1l3/0NNcI+Uz4dCAlRU7YktoD1cWb/eb1XXaOfrdVvWeJHmDxfKTqzC1+1Lsd9dLI g5Duc9IPiWKsY1VbsNNTOIpoCP/bkn14RytKtGZ4IKMdq8pgtPhm6GbO50uLtEF483uf VquHJNKdjBjwNKTzUWDS/6S49AYqYdPJc910tE18zQIu0Md8QblasL+uSiBJiY37WJrI 0BstAUkz8zO5JXFnGpIP9cJhiuaq+tvLVbuNzj2+OiFLtTxwiHw3Z0T09fsvsN+bRVYt lgWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=VgNJ1GE8Vgm6Xrjpg25iYal6CFtq/s9kQyktt7aaKUE=; b=J+wFMEoEIfYhaLM8xAQTwWkSQt5lyB7a8VzQzR1zArCMRVMF3Ia2xXRdbmN8tjrHuh UcQ/Z7PXQq65tMmRbJ6eURcXSb7nV50FNTJDhsQy3N80dhLPwJbWH4+jzzMZiuyPqp+i nl9hOB2KaGafOaXA5xlM+ikfAg37Mw+4xAoXjxTbjc4yimYQIHNIsVriRmRapBsbJ5vO vENe0dpD90HPtd2vGF8UePzs4kt6Pj5RGync7IiMen3kpZ0wBxkmzG2R/K8+B9z/3K0f 7BhlGlvaZS9NbQb1sTwOhsLn0almb0WeRtM9COfzPLo5Rxytbd/pIKrfGScigd0i397t U0nA== X-Gm-Message-State: ACrzQf19PpgwD621ro7M3rHcuSNmhRpXhs82Sm+XHMRi9MXtqS1lnyMm TwpR3p1pPGriVClxowQo3pA= X-Google-Smtp-Source: AMsMyM6zcOmhnWnhzVBi4ImyiM+v9uxCF+36fpU07h+TPPwm4nBzBAWJMVgaipQrQdbr56KhISXwiQ== X-Received: by 2002:a17:902:e841:b0:177:82b6:e6f7 with SMTP id t1-20020a170902e84100b0017782b6e6f7mr16871883plg.66.1664689689467; Sat, 01 Oct 2022 22:48:09 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id f69-20020a623848000000b0055fd8b687fdsm2192713pfa.95.2022.10.01.22.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 22:48:08 -0700 (PDT) Date: Sun, 2 Oct 2022 14:48:02 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Hugh Dickins Cc: Vlastimil Babka , David Laight , Joel Fernandes , Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org Subject: Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE Message-ID: References: <35502bdd-1a78-dea1-6ac3-6ff1bcc073fa@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=G+Nj6O7u; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664689690; a=rsa-sha256; cv=none; b=katqD+g658wXK3TOD1JOwKnykkEQNBCxljMCBnwfnW6vUaB7gRZUbTqWskfiGkJLVHfEED ncKitxbcmqmWXM7yFiayE4ktNfHyS/yYMAN9zTTwI4XuOW5FoVblsOVt8UCcaJh7WERDUH dFg8WTzADyLOV5NG5sRjh15vAyUCcKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664689690; 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=VgNJ1GE8Vgm6Xrjpg25iYal6CFtq/s9kQyktt7aaKUE=; b=Su94bhAxjcC6Wq5OaUE167vXYnNp/h/MjmGD0i8cDEhnMsv+ImVBz3w02mdTgbIJQ935Ek WXUI4Z9lnUYXJT2e4gAzs70sGHUdiF3m2xq89gUkWm4ulZn3m7f0A4VuwNp9eGrU4ivnbP 8ynWN8RbTrg7/kQ8iEs1yeYE5ftfidQ= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CB1A71C0022 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=G+Nj6O7u; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: uaw4rige5xb1nu39wauen7dzypmy63ht X-HE-Tag: 1664689690-978894 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, Sep 29, 2022 at 02:54:45PM -0700, Hugh Dickins wrote: > 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(). Just one more thing, rcu_leak_callback too. RCU seem to use it internally to catch double call_rcu(). And some suggestions: - what about adding runtime WARN() on slab init code to catch unexpected arch/toolchain issues? - instead of 4, we may use macro definition? like (PAGE_MAPPING_FLAGS + 1)? -- Thanks, Hyeonggon