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 X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6E9C433DF for ; Sun, 17 May 2020 10:51:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3E0D42070A for ; Sun, 17 May 2020 10:51:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SSO1c1H9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E0D42070A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ADCA9900003; Sun, 17 May 2020 06:50:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A865A900002; Sun, 17 May 2020 06:50:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94E7C900003; Sun, 17 May 2020 06:50:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 6E678900002 for ; Sun, 17 May 2020 06:50:59 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1961D181AEF10 for ; Sun, 17 May 2020 10:50:59 +0000 (UTC) X-FDA: 76825893438.08.jump71_5f60907302329 X-HE-Tag: jump71_5f60907302329 X-Filterd-Recvd-Size: 4136 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Sun, 17 May 2020 10:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=tRPPR95I4qOYYrz+3gz4MfdcTI0elkXqWJI1+ZZFwB0=; b=SSO1c1H9v42CHcmJwgmeYllQ7P Km7W9wfh09ak6qigwE7B1SCU28rZRLTVtPDNMJBFOjAPp1AAlPdvF4UbczVEuPyE+VE4pgnewazdb ChsnziONk2OkQPHZo1TOOiuhnW+hAMxXI7qnKNpBB6XgGBY25YyVA8QPu0kIkKFeXHWA2IXr5B9bo MqMSjc8xSfYrQ3YmmVhVyWSS2I3DtQCxZtGzLIU7xU+FDczKEMvGIL7tQ1jaBb3yK4jdvxjMm+mTF DkWLTQ9p8mP5Bw0j1vtR6LbKwVpg8fgjsltiIIQ+kedsdJVf56WaaBv+KQ9Ak/CWUnHuZQwYlAIfb gJ/y3bsw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jaGsf-0005Go-Tp; Sun, 17 May 2020 10:50:53 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, "Kirill A . Shutemov" , Andrew Morton Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH] mm: Simplify calling a compound page destructor Date: Sun, 17 May 2020 03:50:51 -0700 Message-Id: <20200517105051.9352-1-willy@infradead.org> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: From: "Matthew Wilcox (Oracle)" None of the three callers of get_compound_page_dtor() want to know the value; they just want to call the function. Replace it with destroy_compound_page() which calls the dtor for them. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 4 ++-- mm/swap.c | 5 +---- mm/vmscan.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 31ec312e8903..688558c57751 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -865,10 +865,10 @@ static inline void set_compound_page_dtor(struct pa= ge *page, page[1].compound_dtor =3D compound_dtor; } =20 -static inline compound_page_dtor *get_compound_page_dtor(struct page *pa= ge) +static inline void destroy_compound_page(struct page *page) { VM_BUG_ON_PAGE(page[1].compound_dtor >=3D NR_COMPOUND_DTORS, page); - return compound_page_dtors[page[1].compound_dtor]; + compound_page_dtors[page[1].compound_dtor](page); } =20 static inline unsigned int compound_order(struct page *page) diff --git a/mm/swap.c b/mm/swap.c index a37bd7b202ac..416fb89c86c1 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -83,8 +83,6 @@ static void __put_single_page(struct page *page) =20 static void __put_compound_page(struct page *page) { - compound_page_dtor *dtor; - /* * __page_cache_release() is supposed to be called for thp, not for * hugetlb. This is because hugetlb page does never have PageLRU set @@ -93,8 +91,7 @@ static void __put_compound_page(struct page *page) */ if (!PageHuge(page)) __page_cache_release(page); - dtor =3D get_compound_page_dtor(page); - (*dtor)(page); + destroy_compound_page(page); } =20 void __put_page(struct page *page) diff --git a/mm/vmscan.c b/mm/vmscan.c index cc555903a332..d96e18726751 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1442,7 +1442,7 @@ static unsigned int shrink_page_list(struct list_he= ad *page_list, * appear not as the counts should be low */ if (unlikely(PageTransHuge(page))) - (*get_compound_page_dtor(page))(page); + destroy_compound_page(page); else list_add(&page->lru, &free_pages); continue; @@ -1870,7 +1870,7 @@ static unsigned noinline_for_stack move_pages_to_lr= u(struct lruvec *lruvec, =20 if (unlikely(PageCompound(page))) { spin_unlock_irq(&pgdat->lru_lock); - (*get_compound_page_dtor(page))(page); + destroy_compound_page(page); spin_lock_irq(&pgdat->lru_lock); } else list_add(&page->lru, &pages_to_free); --=20 2.26.2