Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3277050rwb; Fri, 30 Sep 2022 00:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HZ0IeuJWTpcluHBXihewsJ8s0b24y7dkVPnzvJ06uOecPPS76WkBrvwjjW5D6mfBYLiFo X-Received: by 2002:a17:907:1c08:b0:782:a340:56d7 with SMTP id nc8-20020a1709071c0800b00782a34056d7mr5577143ejc.98.1664524319133; Fri, 30 Sep 2022 00:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664524319; cv=none; d=google.com; s=arc-20160816; b=P5ixDG5dO+1a656k0vKOr4UiZMZ/nbduHZ51jV3QyS74LgI/wZJsqPqRyuxGZONShQ LE6K0kbQAsWs41qgFEjb1iN2Igl6X1VHrgr1vVbowBJyO9OR7vBpl4/ppflW2PhCTxnd d7BUhVR/HmjvFFTgbbiZIMjEK5KDUWTxXuCfd+DKoQlvx4qYA+oPhI5F6KCBletzUkmM dsp4bPt+pAIigeVKMw/diDlb4T2Gqn1EGE5E0JfdFAs2+IuPLnfdjmKvS9vbjQweGCcC raSQVLESfyJ6P2b09k+nyldwGJi0zrX/vkF5/OSy45xZuRnb/fGyYt+sUbokks+tzd4B tD7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=VdrA4yqPrHCz2RiBS5dNiY3uDpMq1COfxzCZsf8wbPg=; b=wclyvjk4nHNMIDqDkF4LBccE2ZgLt9GG9l5/hVRWkj24JnXlUub6Mtq7QwCeQAVYqo cPrEil+haEQPiznO1jGz5LU3xjEY+sGnskpAo3QB6c7vmAmMot0XHqShC0qTWvW8yLlN 1Y0fy3j2HAG6glRNjBwbpWW8DcaIoQOVaLbUcHqrFB9QEAd3FSF4fFyDCGuzs4I1DsUk 1j9/QG3But5sbGdBnvyOSb/AVYOBJBAiIgVGbbT2BguyLuxlgvMSBqNf2Gx2bGmsqu77 muLkNmw153sRSqdMUAUb70YBk0UY8qhVziD8Q6HMaY7V03DwJBEb911oZPsZryOBKFYx ZfIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=HdCtZHuV; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="uZ1/CXvE"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a170906549600b007808a3531bfsi1081770ejo.603.2022.09.30.00.51.33; Fri, 30 Sep 2022 00:51:59 -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=@suse.cz header.s=susede2_rsa header.b=HdCtZHuV; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="uZ1/CXvE"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbiI3HkN (ORCPT + 99 others); Fri, 30 Sep 2022 03:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbiI3Hjy (ORCPT ); Fri, 30 Sep 2022 03:39:54 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 734C126483 for ; Fri, 30 Sep 2022 00:39:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 164D61F460; Fri, 30 Sep 2022 07:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664523588; h=from:from:reply-to: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=VdrA4yqPrHCz2RiBS5dNiY3uDpMq1COfxzCZsf8wbPg=; b=HdCtZHuV/5hiApVAYBlsW1Nine9pPwtWO53QVbErTbVUZ0MloFIjMqI993kO3L4/MjDOW6 baEVztJT+KMnPopWOKFqfZUbHMj+yzKroHCknMQIuTcUbaD91sFArQcFtL8BKLzlRYv1sO +vF3/w8mUfOGulf9c02Xg/Xn1m8UOcE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664523588; h=from:from:reply-to: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=VdrA4yqPrHCz2RiBS5dNiY3uDpMq1COfxzCZsf8wbPg=; b=uZ1/CXvEP98D9+g9G9pqhGIFXMnka+k2mluJqDz6gIKMcKXWcoKy24RsVvhQq4cpe8lL3O 5wZEuYGpKr5a+jDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E7BF313677; Fri, 30 Sep 2022 07:39:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HIpKN0OdNmP4LQAAMHmgww (envelope-from ); Fri, 30 Sep 2022 07:39:47 +0000 Message-ID: Date: Fri, 30 Sep 2022 09:39:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE To: Hugh Dickins Cc: David Laight , Joel Fernandes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <35502bdd-1a78-dea1-6ac3-6ff1bcc073fa@suse.cz> Content-Language: en-US From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_SOFTFAIL 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 On 9/29/22 23:54, 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. Yeah could have been more explicit about that, sorry. But made the whole thing a very last merge so I can still drop it before the pull request. > 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(). Right. > 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. Thanks. I admit I wasn't that thorough, just consulted somebody internally :) > 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. Yeah. But I still would be less worried if another __aligned(X) function existed in the tree already. Found only data. I assume the i915 thing wasn't fixed like this in the tree? So if there are buggy toolchains or anything, it will be us to discover them. So I think we still should defuse the __PageMovable() mine somehow. > So, no worries at my end now. > Hugh