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 59F90C04A95 for ; Wed, 28 Sep 2022 16:21:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9468A6B0073; Wed, 28 Sep 2022 12:21:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F4596B007B; Wed, 28 Sep 2022 12:21:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76D6E6B007D; Wed, 28 Sep 2022 12:21:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 65C796B0073 for ; Wed, 28 Sep 2022 12:21:53 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3E1C2A103E for ; Wed, 28 Sep 2022 16:21:53 +0000 (UTC) X-FDA: 79962010506.27.F24FAB1 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf08.hostedemail.com (Postfix) with ESMTP id 49D1816003C for ; Wed, 28 Sep 2022 16:21:51 +0000 (UTC) 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 82CD21F937; Wed, 28 Sep 2022 16:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664382110; 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=43X+KK3JJPqkxR+LhduWBK5VY3wiG0HooZmEudcIgj4=; b=qPU89nQdXX3oafDIBnk8awWx9vjQ/A3F9pXlioAcH/WyBkIy8S9YiP8pSoEoh5fyZUZNPj /r/OV4+EVluZIrSEthhDBOE+E0E+vm8kVyJTDKMR7TM/Knw/szcvPlifyUer7/5CZC+GZE u5+o5oMXeLHxpUIZQM88fJ0mei3OOvo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664382110; 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=43X+KK3JJPqkxR+LhduWBK5VY3wiG0HooZmEudcIgj4=; b=+tiijjSt5OXUnWz/QMo4mnNcRi8i3lCOwaebCFIkfu5DHYYsjEJXjX5nSQGQ2HK01Z3HlZ KfQ2AGFyvUUY53DQ== 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 4404A13677; Wed, 28 Sep 2022 16:21:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oiXUD550NGMyJwAAMHmgww (envelope-from ); Wed, 28 Sep 2022 16:21:50 +0000 Message-ID: <35502bdd-1a78-dea1-6ac3-6ff1bcc073fa@suse.cz> Date: Wed, 28 Sep 2022 18:20:10 +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: Joel Fernandes , Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Hugh Dickins , Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: Content-Language: en-US From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664382112; a=rsa-sha256; cv=none; b=TgW0QVHWw5kOWW2lAE35YYZKnYv+ljW7NLmV73loELBRYu8JxEsLHE3eattjxsLXUUmnn4 Ny1JhPhCHTVSanTgRVeuVpbbWvyQ7wKGOeUjCQQ5GEx2Eb5qpNwa4wawLQL09vJG9qMr+d aBd5qblRbMPr43TpkBgFOtmDhfZ9EJU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=qPU89nQd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=+tiijjSt; dmarc=none; spf=pass (imf08.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664382112; 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:dkim-signature; bh=43X+KK3JJPqkxR+LhduWBK5VY3wiG0HooZmEudcIgj4=; b=BDYvYc0uqKtTIHrvL03mRQC0e/AcXSPVvpRyYMIL9+zqSk1L2rqJB5m9xx2n8tL/kx24Gy 5sY6f7K9gh1JvnD+rX2aoGG4jwy280csvg7ec4iGKwhz6aYXb9n3qmtBQoZOAqnDJtS2lj trTCAtTl6O231oIX1gXHzPdzZZ54Uy0= X-Rspamd-Queue-Id: 49D1816003C X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=qPU89nQd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=+tiijjSt; dmarc=none; spf=pass (imf08.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam03 X-Stat-Signature: m99xgsw7tkbhbnjq3mftsra1ae1au6qa X-HE-Tag: 1664382111-38435 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 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 had made a small experimental change somewhere, rebuilt and rebooted, >>> was not surprised to crash once swapping and compaction came in, >>> but was surprised to find the crash in isolate_movable_page(), >>> called by compaction's isolate_migratepages_block(). >>> >>> page->mapping was ffffffff811303aa, which qualifies as __PageMovable(), >>> which expects struct movable_operations at page->mapping minus low bits. >>> But ffffffff811303aa was the address of SLUB's rcu_free_slab(): I have >>> CONFIG_CC_OPTIMIZE_FOR_SIZE=y, so function addresses may have low bits set. >>> >>> Over to you! Thanks, >>> Hugh >> >> Wow, didn't expect this. >> Thank you for report! >> >> That should be due to commit 65505d1f2338e7 >> ("mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head") >> as now rcu_head can use some bits that shares with mapping. >> >> Hmm IMO we have two choices... >> >> 1. simply drop the commit as it's only for debugging (RCU folks may not like [1]) > > Yeah definitely don't like this option as patches are out that depend on > this (not yet merged though). :-) But we'll have to do that for now and postpone to 6.2 I'm afraid as merge window for 6.1 is too close to have confidence in any solution that we came up this moment. >> 2. make __PageMovable() to use true page flag, with approach [2]) > > What are the drawbacks of making it a true flag? Even if we free PageSlab, I'm sure there will be better uses of a free page flag than __PageMovable. 3. With frozen page allocation https://lore.kernel.org/all/20220809171854.3725722-1-willy@infradead.org/ slab pages will have refcount 0 and compaction will skip them for that reason. But it had other unresolved issues with page isolation code IIRC. > thanks, > > - Joel > > > > >> [1] https://lore.kernel.org/all/85afd876-d8bb-0804-b2c5-48ed3055e702@joelfernandes.org/ >> [2] https://lore.kernel.org/linux-mm/20220919125708.276864-1-42.hyeyoo@gmail.com/ >> >> Thanks! >> >> -- >> Thanks, >> Hyeonggon