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 770E4C433EF for ; Fri, 17 Jun 2022 17:50:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54F2B6B0093; Fri, 17 Jun 2022 13:50:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF7A6B0082; Fri, 17 Jun 2022 13:50:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD9866B0081; Fri, 17 Jun 2022 13:50:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CA1176B0082 for ; Fri, 17 Jun 2022 13:50:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A140A60952 for ; Fri, 17 Jun 2022 17:50:26 +0000 (UTC) X-FDA: 79588467252.16.72DEBAC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 53C86A002C for ; Fri, 17 Jun 2022 17:50:25 +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: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FkvHFFrIF77Lb8TncotRkJI0mjTAMN5KUfRVh3ZWvkU=; b=PXq+4XK0ZtDzmBMtVIK8E2TzaR FG32X4yuvL+giVWTrBWO6CfIQlEKicBl1WqY1jEGyx1H1oJ2W6lMjomoSQXvAy1SHiIYosusP9fFn mYXoUOy98NNnYBmJ9zqMtHneFXR/25iZUHXzrQTnqE/MXsII1pFkVLXdJ5pYvbveUJtw3USkFaSbb z9IFv5aMd4axTWVruY2f+ns4vaaAnrzcv6HrC1j+011tY/8HZ3fBVBoTDm9kvmWTI5cQKMGPD/xqs MWXTwS9jQfKNoZ1pIuhFDUamSK7sDUc6UU2PJ0UxUHZXmibWTadQHdURVRJUmRNJkq9oLsLMGYBUm 6SpRh0Ww==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2G6x-0030ZU-8c; Fri, 17 Jun 2022 17:50:23 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 01/22] mm: Add folios_put() Date: Fri, 17 Jun 2022 18:49:59 +0100 Message-Id: <20220617175020.717127-2-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220617175020.717127-1-willy@infradead.org> References: <20220617175020.717127-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655488226; a=rsa-sha256; cv=none; b=26zg7AsR+1xf5p0NK2aDzta81eoKGz5Q9B3XnaKtaR7RjuS6v8T1NKrtNe36GUxLVWus1w InCWK3eWjuzmGGx1MlTHc1d75tp1Zt5Re1UUtt84259DGcc4d5AydsTJrnwtmatDY4n7Oz RX0T6x0W3iW6iCDsaIcWz5uUePMK2k8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655488226; 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=FkvHFFrIF77Lb8TncotRkJI0mjTAMN5KUfRVh3ZWvkU=; b=KfEC2xgIvveY8ObP3HZUFdsCxb6o4cpa2AywmoB1maPnwUGcGM5Up4Ayc96diU4uTHhlPa nMY8B3x2R48y0oFdStGOQ7LvmoNyg6CWYR0mDEI18AGKhdgtMd3evMSeUJxwU+Eh0mV4q/ oBpidpxVTWy4eyggNo1LtOtGAgvXuR8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PXq+4XK0; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PXq+4XK0; dmarc=none; spf=none (imf25.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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 53C86A002C X-Stat-Signature: iws4fmyr97y4hpo5ay7ei5o3ss83iik9 X-HE-Tag: 1655488225-320579 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: This is just a wrapper around release_pages() for now. Place the prototype in mm.h along with folio_put() and folio_put_refs(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 19 +++++++++++++++++++ include/linux/pagemap.h | 2 -- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 82b680261cf0..07a1998c3621 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1251,6 +1251,25 @@ static inline void folio_put_refs(struct folio *folio, int refs) __put_page(&folio->page); } +void release_pages(struct page **pages, int nr); + +/** + * folios_put - Decrement the reference count on an array of folios. + * @folios: The folios. + * @nr: How many folios there are. + * + * Like folio_put(), but for an array of folios. This is more efficient + * than writing the loop yourself as it will optimise the locks which + * need to be taken if the folios are freed. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folios_put(struct folio **folios, unsigned int nr) +{ + release_pages((struct page **)folios, nr); +} + static inline void put_page(struct page *page) { struct folio *folio = page_folio(page); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 2a67c0ad7348..7c4748a62841 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -345,8 +345,6 @@ static inline void filemap_nr_thps_dec(struct address_space *mapping) #endif } -void release_pages(struct page **pages, int nr); - struct address_space *page_mapping(struct page *); struct address_space *folio_mapping(struct folio *); struct address_space *swapcache_mapping(struct folio *); -- 2.35.1