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 573E2ECAAD3 for ; Wed, 14 Sep 2022 07:42:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC48E6B0071; Wed, 14 Sep 2022 03:42:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D74D28D0002; Wed, 14 Sep 2022 03:42:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3D858D0001; Wed, 14 Sep 2022 03:42:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B4B2B6B0071 for ; Wed, 14 Sep 2022 03:42:45 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4539680186 for ; Wed, 14 Sep 2022 07:42:45 +0000 (UTC) X-FDA: 79909899090.14.4CE80A8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id DA4D4A00C8 for ; Wed, 14 Sep 2022 07:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/qL9W+SzWLNHnKvVBVn4fKxNoXgKffqZs2eqeyelFh8=; b=uAt5mZZQdAvcBIld9pMVpV65s4 xJIiTLouljdxOZooV7ByVk48AtZqW4Ipc6N+TgwQrw1Vr05J1r6XTPjmVZiTym9dJB7rKbKtrOPQD +7dE31rBZXtXkWcjYA+mPuXnDj3bYngXRCGU+VixEpv03ga/O34Ce8Y8V1oT5zoXYTNkvH2YixC2v q3yg9RJJp6/40ex3PtSn2V31Klxlupng/kShS2pMlAMzMNBSjEYbsBVrqgEPSJRiCuDmevKwpfS2D Yk013Ra5oc6I4a5ew3AJc73mKMOp+Ie/rTam7/tNN2EykVL27JcBsFVH40PhqoL4wK46v1TD2uhVD huV2TrpA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYN2c-00Ha7M-Kb; Wed, 14 Sep 2022 07:42:38 +0000 Date: Wed, 14 Sep 2022 08:42:38 +0100 From: Matthew Wilcox To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Vlastimil Babka , kernel test robot , lkp@lists.01.org, lkp@intel.com, Joel Fernandes , linux-mm@kvack.org, rcu@vger.kernel.org, paulmck@kernel.org, Alexey Dobriyan Subject: Re: [mm/sl[au]b] 3c4cafa313: canonical_address#:#[##] Message-ID: References: <20220906074548.GA72649@inn2.lkp.intel.com> <208c1757-5edd-fd42-67d4-1940cc43b50f@intel.com> <416149c0-1e18-0e00-d116-dd3738957556@suse.cz> <3d178109-5981-f4ee-8fe5-4f1d0c557ed2@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663141364; a=rsa-sha256; cv=none; b=u9nqU8JYqEZ48phDzPl0p/84qfxPhaBmoCv22JTZBQ4uMauV9sNTsgK0lBxTu6AI8lTPYf KFylTYNHqdT2Llt7Bata2LJvARONx0iY3BRJJ9LW0fD9b8Ut8dnGFUaK0154bBi63Q5XA7 mK6WFiG9X8m59WQJBP7RBVVsj7H+pW0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uAt5mZZQ; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663141364; 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=/qL9W+SzWLNHnKvVBVn4fKxNoXgKffqZs2eqeyelFh8=; b=yEY7mtb7fkzxcE8cL4Yu3it0GzEadLk2kX3GqMdTXszTXBrKfXiASUD6ehFnMnQtDfxrPs eNua6VV732AqzQXboAfJIv0CumSKd8Zi/hRxLHBAS4mZbc9NX+K6hqGQONpmJ2dHWl/21/ 73HN4VsDCdHk5qkkM4+aCQ2VZxDaQ90= X-Stat-Signature: sdqf3hx9wxz8589fwqbibeu73ye6d3m1 X-Rspamd-Queue-Id: DA4D4A00C8 X-Rspamd-Server: rspam03 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uAt5mZZQ; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1663141364-630183 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 Wed, Sep 14, 2022 at 03:33:50PM +0900, Hyeonggon Yoo wrote: > On Fri, Sep 09, 2022 at 11:16:51PM +0200, Vlastimil Babka wrote: > > On 9/9/22 16:32, Hyeonggon Yoo wrote: > > > On Fri, Sep 09, 2022 at 03:44:19PM +0200, Vlastimil Babka wrote: > > >> On 9/9/22 13:05, Hyeonggon Yoo wrote: > > >> >> ----8<---- > > >> >> From d6f9fbb33b908eb8162cc1f6ce7f7c970d0f285f Mon Sep 17 00:00:00 2001 > > >> >> From: Vlastimil Babka > > >> >> Date: Fri, 9 Sep 2022 12:03:10 +0200 > > >> >> Subject: [PATCH 2/3] mm/migrate: make isolate_movable_page() skip slab pages > > >> >> > > >> >> In the next commit we want to rearrange struct slab fields to allow a > > >> >> larger rcu_head. Afterwards, the page->mapping field will overlap > > >> >> with SLUB's "struct list_head slab_list", where the value of prev > > >> >> pointer can become LIST_POISON2, which is 0x122 + POISON_POINTER_DELTA. > > >> >> Unfortunately the bit 1 being set can confuse PageMovable() to be a > > >> >> false positive and cause a GPF as reported by lkp [1]. > > >> >> > > >> >> To fix this, make isolate_movable_page() skip pages with the PageSlab > > >> >> flag set. This is a bit tricky as we need to add memory barriers to SLAB > > >> >> and SLUB's page allocation and freeing, and their counterparts to > > >> >> isolate_movable_page(). > > >> > > > >> > Hello, I just took a quick grasp, > > >> > Is this approach okay with folio_test_anon()? > > >> > > >> Not if used on a completely random page as compaction scanners can, but > > >> relies on those being first tested for PageLRU or coming from a page table > > >> lookup etc. > > >> Not ideal huh. Well I could improve also by switching 'next' and 'slabs' > > >> field and relying on the fact that the value of LIST_POISON2 doesn't include > > >> 0x1, just 0x2. > > > > > > What about swapping counters and freelist? > > > freelist should be always aligned. > > > > Great suggestion, thanks! > > > > Had to deal with SLAB too as there was list_head.prev also aliasing > > page->mapping. Wanted to use freelist as well, but turns out it's not > > aligned, so had to use s_mem instead. > > > > The patch that isolate_movable_page() skip slab pages was thus dropped. The > > result is in slab.git below and if nothing blows up, will restore it to -next > > > > https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git/log/?h=for-6.1/fit_rcu_head > > I realized that there is also relevant comment in > include/linux/mm_types.h: > > > 62 * SLUB uses cmpxchg_double() to atomically update its freelist and counters. > > 63 * That requires that freelist & counters in struct slab be adjacent and > > 64 * double-word aligned. Because struct slab currently just reinterprets the > > 65 * bits of struct page, we align all struct pages to double-word boundaries, > > 66 * and ensure that 'freelist' is aligned within struct slab. > > 67 */ > > Also we may add a comment, > something like this? > > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -79,6 +79,9 @@ struct page { > * WARNING: bit 0 of the first word is used for PageTail(). That > * means the other users of this union MUST NOT use the bit to > * avoid collision and false-positive PageTail(). > + * > + * WARNING: lower two bits of third word is used for PAGE_MAPPING_FLAGS. > + * using those bits can lead compaction code to general protection fault. I'm really not comfortable with adding that documentation. I feel the compaction code should be fixed.