Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp101305pxv; Wed, 14 Jul 2021 23:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgcLBeR1TeTyOKw4FTArQHMl5zvBNQuzexGbv9YxY87dpkOmXIQ4KbgbhvmwAFDUERBKtC X-Received: by 2002:a05:6402:516c:: with SMTP id d12mr4407336ede.323.1626331726333; Wed, 14 Jul 2021 23:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626331726; cv=none; d=google.com; s=arc-20160816; b=uMCewUp5goDgPY5b/z+qPkwU35wKz+82HOGwHeqhzL59xQtOMR9I+O07kjGFMQS/i7 cpGb71hF/L9z/rjRpNyDhXFhtVVWpPi9kml156jznJDDKsXV7cl4KbH2nEiP76sAqRNx xXoXc0Gy/HLum/4iHRg99ZD5z+m34ffzznfuYiXTdzIYRCkClUQLMd84/iTQUFXZMszV FifoQ2igtVyxYun+UeLS3ZLn/4kxgHiQg+Kr3Pw8ZBehp9BL1niXQWQu9WUNTH8hsNyP ZkqEdF4AqQr94+Ok+APWzkq+wbngvU4GkZKD725BiVz49hGn2jAL2JkXjgxnUVMct4Q+ O8CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PSN9WkEJMgxnxvx0ERIMZ9XtSwSkMfCNyELdamaG3X8=; b=jsXKTya/jknRZqZQfTL0gvZwc1jI8aixKLXWYEY9bqkGxeJl3ljDDPy+B1rFf6o1rn zYmF77rPr1SC1F9BKGadAbSr9USKeqHGD+kyICc7/3qfdhkaLn3EBDjL1nY6EnNP3A1Y HMZu9TAF9RBXEp0SSzwNVXFL2MF4ap17XSSXdh9bxYX5j0F4YBZzDgaeVqhwaT8D6bvq H+7BS4+86nFRg+9U2efQRdcfSzN8LGRMy3HYKBpKpBAIV7UpOcEvHK98BVGOs9ZHT22z I9Ss/FngtjoGAvLpquF1aoPul0/dPk8fmvNyYpZ0l082G8hYZneZ1DB4r3tZzV0t2PhU bpjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sSanZsUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si5901777ejq.134.2021.07.14.23.48.21; Wed, 14 Jul 2021 23:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sSanZsUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbhGOEEY (ORCPT + 99 others); Thu, 15 Jul 2021 00:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbhGOEEX (ORCPT ); Thu, 15 Jul 2021 00:04:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918F5C06175F; Wed, 14 Jul 2021 21:01:30 -0700 (PDT) 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=PSN9WkEJMgxnxvx0ERIMZ9XtSwSkMfCNyELdamaG3X8=; b=sSanZsUqIYF0IEsFromte2IhP5 v7UWwigspuTBNkvIqFgl+qRldS55g4MSColNQmo4RrMOMEl2Rbn5qTS5a57m/ZXrx3Mqzdjf4sdgU laEF/y5PQ/DGwDex4vrQVrm5KdCn2rRBg1Dg3gK8u9df4d1Vq2KBSR3RbzltxOUb2Mh/6W26ShreJ uRQDpQVIRqslHr9sp2BzF8wbTuKm+sqGx8Nes0Q4xVPCdRinDDO4zLZEp5gQdfT4HlICQvXFITBVG ha5cIqCtPP8myhdeynyRGP2SVjc00cheEe0ZA8K3FrKo5DFrO9MIOTmX8hd7eKhrDHTRAqmEoFClS qZhGaJww==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3sXH-002vc7-2t; Thu, 15 Jul 2021 03:59:54 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Jeff Layton , "Kirill A . Shutemov" , Vlastimil Babka , William Kucharski , David Howells Subject: [PATCH v14 028/138] mm/filemap: Add folio_wake_bit() Date: Thu, 15 Jul 2021 04:35:14 +0100 Message-Id: <20210715033704.692967-29-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert wake_up_page_bit() to folio_wake_bit(). All callers have a folio, so use it directly. Saves 66 bytes of text in end_page_private_2(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton Acked-by: Kirill A. Shutemov Acked-by: Vlastimil Babka Reviewed-by: William Kucharski Reviewed-by: David Howells --- mm/filemap.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index b55c89d7997f..a3ef9abcbcde 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1121,14 +1121,14 @@ static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, return (flags & WQ_FLAG_EXCLUSIVE) != 0; } -static void wake_up_page_bit(struct page *page, int bit_nr) +static void folio_wake_bit(struct folio *folio, int bit_nr) { - wait_queue_head_t *q = page_waitqueue(page); + wait_queue_head_t *q = page_waitqueue(&folio->page); struct wait_page_key key; unsigned long flags; wait_queue_entry_t bookmark; - key.page = page; + key.page = &folio->page; key.bit_nr = bit_nr; key.page_match = 0; @@ -1163,7 +1163,7 @@ static void wake_up_page_bit(struct page *page, int bit_nr) * page waiters. */ if (!waitqueue_active(q) || !key.page_match) { - ClearPageWaiters(page); + folio_clear_waiters(folio); /* * It's possible to miss clearing Waiters here, when we woke * our page waiters, but the hashed waitqueue has waiters for @@ -1179,7 +1179,7 @@ static void folio_wake(struct folio *folio, int bit) { if (!folio_test_waiters(folio)) return; - wake_up_page_bit(&folio->page, bit); + folio_wake_bit(folio, bit); } /* @@ -1446,7 +1446,7 @@ void folio_unlock(struct folio *folio) BUILD_BUG_ON(PG_locked > 7); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); if (clear_bit_unlock_is_negative_byte(PG_locked, folio_flags(folio, 0))) - wake_up_page_bit(&folio->page, PG_locked); + folio_wake_bit(folio, PG_locked); } EXPORT_SYMBOL(folio_unlock); @@ -1463,11 +1463,12 @@ EXPORT_SYMBOL(folio_unlock); */ void end_page_private_2(struct page *page) { - page = compound_head(page); - VM_BUG_ON_PAGE(!PagePrivate2(page), page); - clear_bit_unlock(PG_private_2, &page->flags); - wake_up_page_bit(page, PG_private_2); - put_page(page); + struct folio *folio = page_folio(page); + + VM_BUG_ON_FOLIO(!folio_test_private_2(folio), folio); + clear_bit_unlock(PG_private_2, folio_flags(folio, 0)); + folio_wake_bit(folio, PG_private_2); + folio_put(folio); } EXPORT_SYMBOL(end_page_private_2); -- 2.30.2