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 AFF3AC19F2D for ; Tue, 9 Aug 2022 17:19:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D764E8E0008; Tue, 9 Aug 2022 13:19:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DA7E8E0011; Tue, 9 Aug 2022 13:19:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A905B8E000A; Tue, 9 Aug 2022 13:19:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B69998E000D for ; Tue, 9 Aug 2022 13:19:02 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 97547160489 for ; Tue, 9 Aug 2022 17:19:02 +0000 (UTC) X-FDA: 79780714524.06.347196E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id E54A9A016C for ; Tue, 9 Aug 2022 17:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=GI4BD0DSB8/B3vXN78lMfkT5P8RsZ+pWWQBrt4wkkco=; b=s7umiz5VVT27G6VXZDdYISH8tc 4+OsBY+zvxa8Z6rT3FMjpjhUYLW/2QsXAVSkker0kTHESMrAG6vsDOcKFuJDii8bgamUGukK40Ktf pUpuvS4TVBql1N47ytjKvryV9T1tPiLE/qTaQT3MzXfCLDneEW38vmKc1pE/pDx0aP3nryBdkby+t ViIWeAq+WiCJ1CpFjbgvi3Xd3Tz9Oy8OOIy7qDaFBGBYHWcKZyh51nZEX38HtJ7IwX+N/Q6V/7uai +AbeYOIAMaMoc2nAVwAF0/BbrecHrcaXum4vzXl9jcuIxYtguDGlSKpOoOG0PXuTu6NTUkFuDArnS uRPCEqBQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLSsc-00FdEh-IG; Tue, 09 Aug 2022 17:18:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v2 00/16] Allocate and free frozen pages Date: Tue, 9 Aug 2022 18:18:38 +0100 Message-Id: <20220809171854.3725722-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660065542; a=rsa-sha256; cv=none; b=QqWxrtJ4E8v6KuJpeGesLtLMLi/k1xqGKL22F4+Hc0L6LsoEHXzygli3j4J0iO5HAbZAIP oUYNTS/moorAqorSOhC71jvgAMQpq7+XcUnFvX9IxOZmBALyr2zfxu56Ek2L9FFxWALMKZ 4ha9scKhFQFwAFmvS1m6gBZhtVpUbUs= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=s7umiz5V; dmarc=none; spf=none (imf15.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=1660065542; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=GI4BD0DSB8/B3vXN78lMfkT5P8RsZ+pWWQBrt4wkkco=; b=Gqvzn2KXoXAG8hF4S3kogQnIOtHfgdt8iIxp0JzDtM230jYM1mkAniy6sEzBHyYaz31wSa sNzmeB4AHBa9RKk7DzsXP/dzUOsIslW3B68iUX662qhXjBmeg8qughtSpp+8qM7X7/j41E LmOISTF29YrqN5pFLBIAM6M0cC7Up40= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E54A9A016C Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=s7umiz5V; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-Stat-Signature: z3gxoj4egws8nregksokoc19opozc818 X-HE-Tag: 1660065541-939007 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: Slab does not need to use the page refcount at all, and it can avoid an atomic operation on page free. Hugetlb wants to delay setting the refcount until it has assembled a complete gigantic page. We already have the ability to freeze a page (safely reduce its reference count to 0), so this patchset adds APIs to allocate and free pages which are in a frozen state. This patchset is also a step towards the Glorious Future in which struct page doesn't have a refcount; the users which need a refcount will have one in their per-allocation memdesc. Compared to v1, this patchset has been tested and survives a few hours of xfstests. Vlastimil fixed a bug where compaction needed to initialise the page refcount itself. As part of that debugging, I split the old 4/6 into ten patches; I've opted to leave it that way to aid anybody else trying to bisect a bug in these patches in future. I also dropped the old patch 1/6 and replaced it with one that moves the call to page_zone() a few lines earlier to reflect other changes that were made to page_alloc. Matthew Wilcox (Oracle) (16): mm/page_alloc: Cache page_zone() result in free_unref_page() mm/page_alloc: Rename free_the_page() to free_frozen_pages() mm/page_alloc: Export free_frozen_pages() instead of free_unref_page() mm/page_alloc: Move set_page_refcounted() to callers of post_alloc_hook() mm/page_alloc: Move set_page_refcounted() to callers of prep_new_page() mm/page_alloc: Move set_page_refcounted() to callers of get_page_from_freelist() mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_cpuset_fallback() mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_may_oom() mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_compact() mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_reclaim() mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_slowpath() mm/page_alloc: Move set_page_refcounted() to end of __alloc_pages() mm/page_alloc: Add __alloc_frozen_pages() mm/mempolicy: Add alloc_frozen_pages() slab: Allocate frozen pages slub: Allocate frozen pages mm/compaction.c | 1 + mm/internal.h | 15 ++++++++++-- mm/mempolicy.c | 61 ++++++++++++++++++++++++++++++------------------- mm/page_alloc.c | 53 +++++++++++++++++++++++++----------------- mm/slab.c | 23 +++++++++---------- mm/slub.c | 26 ++++++++++----------- mm/swap.c | 2 +- 7 files changed, 109 insertions(+), 72 deletions(-) -- 2.35.1