From patchwork Wed Jun 21 16:45:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13287650 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 98015EB64D7 for ; Wed, 21 Jun 2023 16:46:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C40098D0005; Wed, 21 Jun 2023 12:46:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72C118D0008; Wed, 21 Jun 2023 12:46:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 492828D000B; Wed, 21 Jun 2023 12:46:06 -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 1748E8D0006 for ; Wed, 21 Jun 2023 12:46:06 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BA961C0942 for ; Wed, 21 Jun 2023 16:46:05 +0000 (UTC) X-FDA: 80927332290.30.D29062A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id 95203C0015 for ; Wed, 21 Jun 2023 16:46:03 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PW4Dwh4G; dmarc=none; spf=none (imf22.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=1687365964; 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=S9L58IPbLSJMGWxFtvlnrG4TzIQ7IOqSwhUMe45kT8U=; b=Cyf01w27kFGmuVxKtmq8swP1SKyqs6aii5H27Gvx3+Cx1I4CHAq8t+VZZ4zDDOFv3tJcAF ZJbNW5xsLPUcASvbAdMcE38BUJz5iyAG5d1CY+nYdrPrEb5+NIyqAMA9CWcnnc93WV17t5 rk9nkwbONs3Cr7WMoRuOkoFCbny5K3U= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PW4Dwh4G; dmarc=none; spf=none (imf22.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=1687365964; a=rsa-sha256; cv=none; b=MOmU9UIQ8Ve7gezvqbL76RnSmZ1Nirf2217llLPzzI1Bb9Rhp8yi4R5UyueVEkTDTOgDvl /1Uf/D2tCH/fYUTxG3+MOCkOcjNJBDAXKzIy5+EW+Z0su/IC5nFjUTR9zOPnrVfK9gzxKD i9OSuZGZBBmYlYBQKyFLgvN1WjJjHfc= 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=S9L58IPbLSJMGWxFtvlnrG4TzIQ7IOqSwhUMe45kT8U=; b=PW4Dwh4Gf1suM6iF8qmdwxhedV dGBA+OGAVi6nz1TzXhqQwejLNG6p8I/gHBdyJdF+v9Gwlfc+qXUjfsQRhEupLyGODb3oBlcxjqeZg MjDYrwlGzkp9KSAXfQWGPMLoY7z8XE2Ha7+Drv6kVcDGv88l6mKIj3vMNnmJc0wPJLF/1/j23opEa eo5D3L64k7UfoSUT0lpwRO6h7SIv4cOQ8G08UCt/pjyMlmUKsodXKsDFTzzN9xwAVenix5X7iC12y ymJp18fQp4MbBy2x2WRcwk0mKw0eF20AfD6Cvpc56WVKj7Wa6gjeZD91h/NOb3XGNU2NojtTr6joC HO//Edeg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qC0y2-00EjEL-0r; Wed, 21 Jun 2023 16:46:02 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org, Andrew Morton Cc: "Matthew Wilcox (Oracle)" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 08/13] i915: Convert i915_gpu_error to use a folio_batch Date: Wed, 21 Jun 2023 17:45:52 +0100 Message-Id: <20230621164557.3510324-9-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230621164557.3510324-1-willy@infradead.org> References: <20230621164557.3510324-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 95203C0015 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: c6j3dghcotn9kku1h18inezufon5mnpa X-HE-Tag: 1687365963-64682 X-HE-Meta: U2FsdGVkX1+N8Ic+yLR7oBJFAXfhEezjNSWxfIVanqn5INAJZsSRf1L8QDn5ZL9V6Dmx/eZHyImf4MF/KQ6Rd1dTaaqrqGAzWryltfo5k1ZKHO9ZoL3ho0FTuS4I005D5VWoWyQfK/qfr7xNpIHG0h4J58HzOB0g1nqdy+i0vAAVqKnB2Cl5sAx/XRV9VdPz2GHMsffKZGbZCTI2OwjylIbg0S8ITU41cd9jE89Hl38OBrZLJu78nHvGMQ9NNM4o2f+alnbZIE6FkxD3QF0Pxch/ltvtsF8bN8to+qCMuQRL23dvNam6zBCoAxB3qW1wigA1xS0bVhplt9+YPq0fyuHe0xpvrksGkwqLc2lRZ6DtSkEGniHOE11cawjW1i2l0bpjm9ZV3fh98i1H5v8VGqFzrNY78eXbRHk/DdxRVj3oEyYpQxc2WZe+blyO4cb/7gY3y6DwpjWyuwx5iB9f0jNR11Xjrg43bk+HV6w38psxvCn7FECCENJgj9nb0FRvNcJ3fgPN+CS7KR075+jK1ZtHfn5zrmYaEwrN3KuxdtwrM5klsrjiGMbrAgMaPuxN+AwrtQ3CdibllQ1DkPvvV44w4jKLoHdie388AwYuZJhJz3Bzh3cFVhnojP8l5QpjWyTmtoXPL+ZztjuZK8h99osheLKed2nudUr3BxwoSEzRLNJAQZMm08wHqIdHq+kW/MFzvkLl9ZLFNWDxJzhDpvjMSHckKSAJqqP2Y+3fkT+YJkqM9YK9oBXLkVneMd0tirJMAUdJiduxCnkWXRiS/sNPsOjcxlKu7EAF1FA6KYOcmZi7ICo823nAyqiiTzBAuKyrF2vPf6WB1uYgPK4S04fWMryhUCovodfCiaoVvWOE7HysGhvzlfTkAqlp9r7ygvJp7fTefLI0XiKlXXf40mmt4BbxO1ILqBJWb5lNR15Lc4JdX1WbKOIE4BjIQrGZ9jI39VnyB+jhRMVn1CE XNSTtZ3e SlDbbV+oyjq+HbwpsG6Uc50T1oisR/6p49GAtSgGVIG1hx4hcLeJa3i0kfPU1stveCoEwg2HaATQZW+Og0DCpTVOQ5OOgTDLLiF/PhtZjQFNIN0syJKJpoxoTOzVUgZ11qiUzX5Tlq9p4stZ6Mqn5hlL7oVB+cAKWroc3xotadrRmjthGxIfEGaAOZyAYQfF276oenmXxlmVxTj+QUpngf2CErqQRyqduWKqI 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: Remove one of the last remaining users of pagevec. Signed-off-by: Matthew Wilcox (Oracle) --- drivers/gpu/drm/i915/i915_gpu_error.c | 50 +++++++++++++-------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index ec368e700235..0c38bfb60c9a 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -187,64 +187,64 @@ i915_error_printer(struct drm_i915_error_state_buf *e) } /* single threaded page allocator with a reserved stash for emergencies */ -static void pool_fini(struct pagevec *pv) +static void pool_fini(struct folio_batch *fbatch) { - pagevec_release(pv); + folio_batch_release(fbatch); } -static int pool_refill(struct pagevec *pv, gfp_t gfp) +static int pool_refill(struct folio_batch *fbatch, gfp_t gfp) { - while (pagevec_space(pv)) { - struct page *p; + while (folio_batch_space(fbatch)) { + struct folio *folio; - p = alloc_page(gfp); - if (!p) + folio = folio_alloc(gfp, 0); + if (!folio) return -ENOMEM; - pagevec_add(pv, p); + folio_batch_add(fbatch, folio); } return 0; } -static int pool_init(struct pagevec *pv, gfp_t gfp) +static int pool_init(struct folio_batch *fbatch, gfp_t gfp) { int err; - pagevec_init(pv); + folio_batch_init(fbatch); - err = pool_refill(pv, gfp); + err = pool_refill(fbatch, gfp); if (err) - pool_fini(pv); + pool_fini(fbatch); return err; } -static void *pool_alloc(struct pagevec *pv, gfp_t gfp) +static void *pool_alloc(struct folio_batch *fbatch, gfp_t gfp) { - struct page *p; + struct folio *folio; - p = alloc_page(gfp); - if (!p && pagevec_count(pv)) - p = pv->pages[--pv->nr]; + folio = folio_alloc(gfp, 0); + if (!folio && folio_batch_count(fbatch)) + folio = fbatch->folios[--fbatch->nr]; - return p ? page_address(p) : NULL; + return folio ? folio_address(folio) : NULL; } -static void pool_free(struct pagevec *pv, void *addr) +static void pool_free(struct folio_batch *fbatch, void *addr) { - struct page *p = virt_to_page(addr); + struct folio *folio = virt_to_folio(addr); - if (pagevec_space(pv)) - pagevec_add(pv, p); + if (folio_batch_space(fbatch)) + folio_batch_add(fbatch, folio); else - __free_page(p); + folio_put(folio); } #ifdef CONFIG_DRM_I915_COMPRESS_ERROR struct i915_vma_compress { - struct pagevec pool; + struct folio_batch pool; struct z_stream_s zstream; void *tmp; }; @@ -381,7 +381,7 @@ static void err_compression_marker(struct drm_i915_error_state_buf *m) #else struct i915_vma_compress { - struct pagevec pool; + struct folio_batch pool; }; static bool compress_init(struct i915_vma_compress *c)