From patchwork Wed Jan 11 04:21:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13095997 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 E250DC54EBC for ; Wed, 11 Jan 2023 04:22:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 352D9940008; Tue, 10 Jan 2023 23:22:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 301EA940007; Tue, 10 Jan 2023 23:22:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106B3940008; Tue, 10 Jan 2023 23:22:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 01749940007 for ; Tue, 10 Jan 2023 23:22:34 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D2AC0C04AE for ; Wed, 11 Jan 2023 04:22:34 +0000 (UTC) X-FDA: 80341221828.04.ED64D79 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 2F64A40015 for ; Wed, 11 Jan 2023 04:22:32 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=rXlLddMW; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673410953; 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=oJXlJV+xhbtSVawf+Q+5NVB7QM515lQScfXBhApxCL8=; b=g1F2ZZ09LpYf4218DFQ/qMVzz7/fuWiC/eCf8Xtrz42ERF/WSgq2sGbLMqbGx71ZeRYy4Y zU161pI44HxlWtheBAxZbqJW21gXRO+p0KHgxklUCwOrWKxD6FvObcQxzgNfp6tfK0d331 d/DNJQ5Xc6lnI39+/ya2S4xhLx+n88E= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=rXlLddMW; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673410953; a=rsa-sha256; cv=none; b=o/Rcv2QkXOFpkRztTSKr0CSmNQDG/a8LNHnlO+dl5pcp514DpxnRqmQGZ6x8cwepFdA5KB xxDcTRLpcN3l8GmDrFcQkbrIEm2iWfLHtM8pzclgp2q0h0TW0C60oJ4SX1u2VZKRurMrLs Z+rXzq70vXxA/cTbsN63F1Kjtq+cL88= 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=oJXlJV+xhbtSVawf+Q+5NVB7QM515lQScfXBhApxCL8=; b=rXlLddMW1WaOxYEqGX51ttgdPu NkyrU0uI1GkRHbtzFkqu/yrvhq81Yd+VFFuPTUs+nLug6/DlUlEh5pObp4GR4SZ3wcArtOicihz0J 1n8gMsg2B9xcVfnJIPIFnwM0zd7RGQ60pDHj9Eve2PNhiDFfnMShzDvNFOLC20ngWB21qzy/sS3Bm DFqWgBnM/vhhiryHYjNPewy45XLCOjejxOsEJ/8JurwWk3b2+d5tFrYXZDJGP0qRsbGdeizb0xZzL rFGp+5mRSh4K/R6oy6JF2coujVkTVal2S6qdtma1bAMLu2xMbWM0ZOah7W5RoeVxFRES6pDDLJ9kT uwsmNuxw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFScy-003nxy-Sc; Wed, 11 Jan 2023 04:22:16 +0000 From: "Matthew Wilcox (Oracle)" To: Jesper Dangaard Brouer , Ilias Apalodimas Cc: "Matthew Wilcox (Oracle)" , netdev@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Jesper Dangaard Brouer , Jesse Brandeburg Subject: [PATCH v3 09/26] page_pool: Convert page_pool_defrag_page() to page_pool_defrag_netmem() Date: Wed, 11 Jan 2023 04:21:57 +0000 Message-Id: <20230111042214.907030-10-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230111042214.907030-1-willy@infradead.org> References: <20230111042214.907030-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2F64A40015 X-Stat-Signature: a9i7xqzcbjd8p4odmpbnwk6shsd8s5eo X-HE-Tag: 1673410952-19816 X-HE-Meta: U2FsdGVkX1+t+v9/XFZkDevqXoVhi5nuOe7WrwfICtamS+AOYItLenhchW2QaAmvF3/ce/S3l+8bMaEQPoJ+fz+aVKrZvwIUbgzp75HvfS8lpjGrEXEKysdyfEbWWnND9f5TM1//u7oeboQvMvps1QQSdbRhALn06SvGT1CnHaRf1pMN9CvfehXt/VCdI9fzSaOEoGyoPFJ7vvXNXcX2fwMXoiblMzVmb7u9hjIJjQpyrYgVZYvgL2i0plHegiPNXchtjtryvGpLHXCFmRCm0RHrwxeNFwFgb3ZjBPSGSEhDNW1gWN2QGgAOfG6oExpUg5Tz9LygPwvyQgRRtg03mQQSG56mJ5PMhcuWz+3mMoRwrO/xs8oWfjhxkBe/0IQVfZhIerly2STfi6p5C3vdeA2mmKshR/vTpZu5Jaaqxdc/3ujGeyYjmbD+k3LXWzt+TJ79BlWssVU5+qOQaI5tzuGL2Db3AiouDTuiXMBmY4D5yOj4kK+khKX5iEEEfT8UjpWSusBsc5oHRSFMGoR2uGB3riPTuvQKoz48ZOL4Cn8HuuCVRza/HDObjAUfHannNNWgXSBMyG0/JshxlgFz5wVEyjkH8j5vn3WnonhZ9iYPG8xrgeE2qFzI9xW5ugggBPBU2RBC1oi2Ipbf0G6KIOzsJJ2ZesVgUmISo2yNdpIW44sxfoM0seRl0wYMfNtY5EMtrSyaP6JXJyCe9sgYCfHTdCRRpOMdw/47v/upwaCBymuanjyHY0wRQ8Oi5RjwdX+ahR1j7It4o72K0gYIAeOdxRrT61RBi2EN7kHBUOyLH4kje9fxfD+0/qB4h9B7GZVFgkLl/BGHNWGRlqJkeiGlCuM4o+SAlj8k570GPYaPQwvRxvlvxyQ/VV1jtXrTrNtMi7AnxGLwWFNccIxUR3D8dC5UT70zraTIjnrC6GrbtGz+A2i9tQ== 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: Add a page_pool_defrag_page() wrapper. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Jesper Dangaard Brouer Reviewed-by: Ilias Apalodimas Reviewed-by: Jesse Brandeburg --- include/net/page_pool.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 583c13f6f2ab..72e241ebed0a 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -394,7 +394,7 @@ static inline void page_pool_fragment_page(struct page *page, long nr) atomic_long_set(&page->pp_frag_count, nr); } -static inline long page_pool_defrag_page(struct page *page, long nr) +static inline long page_pool_defrag_netmem(struct netmem *nmem, long nr) { long ret; @@ -407,14 +407,20 @@ static inline long page_pool_defrag_page(struct page *page, long nr) * especially when dealing with a page that may be partitioned * into only 2 or 3 pieces. */ - if (atomic_long_read(&page->pp_frag_count) == nr) + if (atomic_long_read(&nmem->pp_frag_count) == nr) return 0; - ret = atomic_long_sub_return(nr, &page->pp_frag_count); + ret = atomic_long_sub_return(nr, &nmem->pp_frag_count); WARN_ON(ret < 0); return ret; } +/* Compat, remove when all users gone */ +static inline long page_pool_defrag_page(struct page *page, long nr) +{ + return page_pool_defrag_netmem(page_netmem(page), nr); +} + static inline bool page_pool_is_last_frag(struct page_pool *pool, struct page *page) {