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 BBDCAC433F5 for ; Tue, 31 May 2022 17:33:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 571376B0072; Tue, 31 May 2022 13:33:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FCF86B0073; Tue, 31 May 2022 13:33:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BFA66B0074; Tue, 31 May 2022 13:33:07 -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 2DD396B0072 for ; Tue, 31 May 2022 13:33:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ECF2B206EE for ; Tue, 31 May 2022 17:33:06 +0000 (UTC) X-FDA: 79526733972.16.9BBB6A6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP id 7B6822006F for ; Tue, 31 May 2022 17:32:25 +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=6yTDqLXh0td8yDWZo0TvEObToM07ctqTEg2PfQ027Lg=; b=O2vbT0Hji4jXy7qEAlh1lXuvYN jmWK7btQ77rfu8s9TWTMZSnZ+vbVz2mQALWvfkUswi4DlhmLzkX43CQ38dgIKVY0bEwBRX6+A4u8P hRQcCw9wEV1D52fQDFj+uFRzYIdOfpQPrsEaOSEVw/ESvXB+o7l3315O+Fw/ZmWlNUT1kBzBC5SVx rrvThZVsJFDcDcwDD4kllYenHBQtdPvPcXvBAtV2acP5PDBJ3nVL/spW8MB98PjY1Fn/SWVfDXCfe x5nvKC+A5vmfuAO0qQKmhd4bBAdbLVBttun7EkU4VuyddBN0lgVQdPeqeKd1Z2dcyziQIZc+SvD1e ruYE/zMA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nw5js-005Z6f-Di; Tue, 31 May 2022 17:33:04 +0000 Date: Tue, 31 May 2022 18:33:04 +0100 From: Matthew Wilcox To: David Hildenbrand Cc: linux-mm@kvack.org Subject: Re: [PATCH 5/6] slab: Allocate frozen pages Message-ID: References: <20220531150611.1303156-1-willy@infradead.org> <20220531150611.1303156-6-willy@infradead.org> <40d658da-6220-e05e-ba0b-d95c82f6bfb3@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40d658da-6220-e05e-ba0b-d95c82f6bfb3@redhat.com> X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=O2vbT0Hj; dmarc=none; spf=none (imf31.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7B6822006F X-Stat-Signature: rgn7ch5y3mg7a7hb1bw51ffqhwqeoxdh X-HE-Tag: 1654018345-232236 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 Tue, May 31, 2022 at 07:15:14PM +0200, David Hildenbrand wrote: > On 31.05.22 17:06, Matthew Wilcox (Oracle) wrote: > > Since slab does not use the page refcount, it can allocate and > > free frozen pages, saving one atomic operation per free. > > I assume that implies that pages that are actually allocated *from* the > buddy now have a refcount == 0. Yes. > IIRC, page isolation code (e.g., !page_ref_count check in > has_unmovable_pages()) assumes that any page with a refcount of 0 is > essentially either already free (buddy) or is on its way of getting > freed (!buddy). That would be a bad assumption. We already freeze pages for things like splitting, migration, and replacement with a THP. If the usage is just an optimisation, then that's OK (and maybe the optimisation needs to be tweaked to check PageSlab), but if the code depends on that being true, it was already broken. For this particular case, I think has_unmovable_pages() is only called for ZONE_MOVEABLE and Slab never allocates from ZONE_MOVEABLE, so it's not an issue? > There might be other PFN walker code (like compaction) that makes > similar assumptions that hold for now. > > -- > Thanks, > > David / dhildenb > >