From patchwork Mon Nov 25 21:01:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13885267 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 8D97CD59D71 for ; Mon, 25 Nov 2024 21:01:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F6866B008C; Mon, 25 Nov 2024 16:01:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DFDE6B0095; Mon, 25 Nov 2024 16:01:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AAFE6B0092; Mon, 25 Nov 2024 16:01:55 -0500 (EST) 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 0D8196B0089 for ; Mon, 25 Nov 2024 16:01:55 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A9CBF120EBA for ; Mon, 25 Nov 2024 21:01:54 +0000 (UTC) X-FDA: 82825839222.21.034E2F2 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id 2EA678002D for ; Mon, 25 Nov 2024 21:01:45 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=wBeTkPO7; dmarc=none; spf=none (imf30.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=1732568511; 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:in-reply-to:references:references:dkim-signature; bh=Ag4W615eOv8ytJfj90k4CCqQ2bMgFGGSZEjGvrUQlnk=; b=gqTd+K7pBd0chaAYPFexrpbHuCgDT+ovSP0zhgKlWliMLRGnJ/LeeDa2mwQilXa9h0DqmR wlEXDXu6F2JaXcEg7hs7qWxTN6xgdmmdnMEMOYHQZ1vo0SB62zWzGDNB0gWYHtbKNv3hBE j2X5UdSB1jn+fyjsNg8YdDDrktuY23c= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=wBeTkPO7; dmarc=none; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732568511; a=rsa-sha256; cv=none; b=XTcfgb88KHSkNkoLIu5VE8JBf7mNjljUHeoVXM9d9eMHsrlEAxOqvRNhmMXJ4Z3pYTNLvo c47iwQBGBg6ycn2nnvUyS0P8WvJSON0R8XgorexmqS9xFOHUlDWriPmbc37x/6dURjVOrH AinEk0q82AIZLfWKGcgeB4UeLtZmFWM= 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: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Ag4W615eOv8ytJfj90k4CCqQ2bMgFGGSZEjGvrUQlnk=; b=wBeTkPO7iJA3a1kq+yGWtIU7O/ E45K4yWJaZgnCsRBA+C0gtnd6hgNlf5Pg2OkBlPRy4O8tkpO66Vi1a1bHjiTCxZEbBygdhZiMFt8/ +ylyowTqD8jJyTiVbCf/9eAoF4sq6vnXdGhoSxJtodRzWQgJ9en+az1e56+Xa1dwBgsbTfEsJOJ+K duklq2csT0AwSzG1CMiTOyg3whUq32HvYoMb2CLUxcXYzBy1TTOS+Z3jO4QzZOpN7A7O7Xm3wVpKO UJEP6Ep8dEM805SM/jpjYIKJdG5oT1/mpfNrXlT6pXeBj9lVQqA1CGLYEwvIkCVPszaAlK0Wz2qJc O1yoXTvw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tFgDP-0000000CUEJ-2ybr; Mon, 25 Nov 2024 21:01:51 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, David Hildenbrand Subject: [PATCH v3 09/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_compact() Date: Mon, 25 Nov 2024 21:01:41 +0000 Message-ID: <20241125210149.2976098-10-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125210149.2976098-1-willy@infradead.org> References: <20241125210149.2976098-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2EA678002D X-Stat-Signature: poi48y71rkpiar1trdhf5ssue1zekxmc X-HE-Tag: 1732568505-488056 X-HE-Meta: U2FsdGVkX1/OAkhkpmc7nxwissE09i1rsvPnhYxP6lTMelJqN5xZLn0rH4noDK7+nJ7xh+ZxBziAreCJYFUdangE1lHvYuKpwLufXVXp3II++On96malPd5P9nXH4MhrMU5lJWEJLJwQ2vwFX1Ds3hoLCFmKscR+FJVdrI/hpRKv300h6vOqxlQUKPA/j0RneZCXX99phzH/qNHKqkhwlNj3XjGjcNUat+dWrlkhCdgiLhBaneI9mQz2yM96VQSsDvBT5KpQC3NoVt2TwUkBWdh2+J9vkGkdgPY22czM4tv8N7J/k4yRsRwtsp45tOLk2ShChZZ3MwEyo3VJ5bVlj6uWeLxln7q7rRIW1q0yPsjIi7wptHv+b2YQPFTY/nuzW6Z/vEoEjcWm2hMxMB5E8/4bVA6Gll0WEJfj9m0ee7MTXPtkUqC/9qiy3Ker281LDUxI7oIWoTQ6dScQhRSAuGivaCIlxV7eXdPmm4iPlXITNX0izL7SgKpqPkFgP21JhpV/zKzj3ISXnvyaDkC/s4aXWqSoTcgObf1gS7JOEfiQg9rZ/lSbYgi+xe+On2lJIGhax+XWy9g1xwqtRiha5ky/rsOgU9JHU2TbrtTqM+j8jB1sncCQN5hytePDWdMuTLZ5MHY23InIVMz3uA3ZW8U/YXw2RMarJPMxz0RhYGhmX1M7DNwXW7gJRcJKxEs5KKqAzv01gkt4tzvNgefvpQPm/coaPU4WpE5czKI+CJwBn8u13rwwA1qDvoB0zTscr51UlIUm3L+tvpz1u4kEv6r9fkff/wa/d0qPhJNTqtHX4baEJj9BOKn+chaxufYQ/mVt8tcHWyDNiVC0KqDtUBB6hBRStsLVXpKyeX99oZ4W/vBiz8bwmNQdTGDAoeF0x9dfhMRyGROsTwph0VcDNFCjr/WO+I4czzYnQHY3RCyDcIDLZhJTeZco61Bu6Ll0QjpXPnb0ax/jd0AqtmR vT1+gsNt +TkORIKYoex9YEni42/Umi8GSnTyii/+gj9f6rvDTb6xLb3oqBCsLq1KYS759eflbwTKM4N4pUTBJK1zQHS70i++LnD+d86yOcuyD6MJJodgJdfhCaZBDtr8ZkLVrlxSfRkeyHDLxylcUgR3tuPbYVEltfh56jDwcvIS6MtUhIYc4buVk2RpkaKCkJuGt9JCWjr8sHit/aCNhGfqFwLuqM2IixvxrIp6DBA8an4YP/BHvWyMgNrqWIpbPIjk1fPDUPty+grEAwDVoQAtPepSv8Hd5g0QvNnxT2OLd 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: List-Subscribe: List-Unsubscribe: In preparation for allocating frozen pages, stop initialising the page refcount in __alloc_pages_direct_compact(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_alloc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 514994cd67b8..0f02cb253bf5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3740,7 +3740,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, if (page) { struct zone *zone = page_zone(page); - set_page_refcounted(page); zone->compact_blockskip_flush = false; compaction_defer_reset(zone, order, true); count_vm_event(COMPACTSUCCESS); @@ -4342,8 +4341,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, alloc_flags, ac, INIT_COMPACT_PRIORITY, &compact_result); - if (page) + if (page) { + set_page_refcounted(page); goto got_pg; + } /* * Checks for costly allocations with __GFP_NORETRY, which @@ -4425,8 +4426,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, /* Try direct compaction and then allocating */ page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, compact_priority, &compact_result); - if (page) + if (page) { + set_page_refcounted(page); goto got_pg; + } /* Do not loop if specifically requested */ if (gfp_mask & __GFP_NORETRY)