From patchwork Thu Jan 12 12:39:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 42404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3860350wrt; Thu, 12 Jan 2023 04:47:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXsC36fy+Uz2TkvROukbrxwQ+Mp2w3rUvQj4tecwiyZsWp0syiffEM5bYkQ52Vhua2muY6eP X-Received: by 2002:a05:6402:793:b0:493:597e:2191 with SMTP id d19-20020a056402079300b00493597e2191mr20602574edy.35.1673527662988; Thu, 12 Jan 2023 04:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673527662; cv=none; d=google.com; s=arc-20160816; b=TWS6wCKpSQiGNsg70fIhIWe568ChLlIoeftQrBbqHMygtTJ8kWJFVVEyawOGx53C5c iaz6FKve5rTEBbOmAIQlgataa5QEes0z5H6XxN6WZGNEiSRMjFPMoBW2n0eKefnI845t tJ0+gNnTSKaXU7eWK7UyampoDwMA2hM97WL0QdNl0KRhHEHONUQPGAEBctaR6kSXer2T bXr3NmKkNAt2UGf/S+GE3masZW/1gQVncnbKYKZtQUU/GxGI0ZsCaeI1oShKcwu/OADR M/AQ058O61DWeHJBIfFmsNQSXdqISnR00JyDJVT21peJRjrXQm7oT7dkA9/NeDwyYl6o Bzaw== 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=Nvh72pnq+35pgvvJPMgZ8nog2n55QNfKwj25JYsdjLk=; b=z3o0C1Ytjn/GsGOXpKOcNisCa0pcGeJbNJGZXOUTTisg/DxMcHYas5JS43PKG/aQWY knkDAukaHaYfAxjo4z1LuuDb5sn/oD7z6bhRvY9xWsz+AJlQHElgXPgqsgfOJ0P7Un9A 35ywr8XuKTn80Tg8EUMEeDBHuvD9wDZT2SIw5wG3ev6sWPT8rVDZ9ow/tb6jACrX9HoN D09ajBFo/pIQlBBCSXggkrd5ijPfYn8BmQTy0xA2+L4ukK+ibd6G0qxOFvAAJHRoiHqW T2u8c2RMSJuta+8Jc5ukOWzOvoNIhaEaK9atS+1msgMUqkIkZy2k8k8nnRqymoy5GusB ZlYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=femgMvhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a056402054700b0048eabb857fbsi16786941edx.408.2023.01.12.04.47.19; Thu, 12 Jan 2023 04:47:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=femgMvhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbjALMkJ (ORCPT + 99 others); Thu, 12 Jan 2023 07:40:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbjALMjy (ORCPT ); Thu, 12 Jan 2023 07:39:54 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93773496CE for ; Thu, 12 Jan 2023 04:39:52 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so14926540wms.2 for ; Thu, 12 Jan 2023 04:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nvh72pnq+35pgvvJPMgZ8nog2n55QNfKwj25JYsdjLk=; b=femgMvhvRMHoBUQrdPDL69x3b05v3v15o093QGsG9jpjlB/Y5S0Sbx7BNVz8opBVue UMKh3NQPtcCvjVsWeKoobMleZZDAAvnXaXc/xbzXjsgiBc+98105RM4/FmmvgKnQmP6P gjYsVUBDvBxet9J50eSjKCFWGrAE/CMkiripO4FUXf8PmN+rp6AKLKaLaObV6XI9pQ2Y LXLPmEAQsMCVfHDL5LiYmtFQF/iFYp9M/J75j6s9qtF61YjFCqrG696W1vTyUCV+XqX1 X2qVSpi4MPYCrStXilHNMDWJ6UEZy5s4SjqHObQWaHhwB5fCwBMuN4963ydfh2mBXDLJ 4ySg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nvh72pnq+35pgvvJPMgZ8nog2n55QNfKwj25JYsdjLk=; b=XpqBtRV0q7cJwJgEPIzCq1qcQK7ZRYiEPmSPOhgFTaaWgaBoXFwFxIROCIJAL8sc5d WGhGoehK3Wk0HHzZxinS4IXomrHc/913naD1gjo7jt6uMC4QuYtcr3poCP5ovPGTLMhS AgFosIFnzxBIN0/aAciwjoOoQTQvK+QWHJMmpTGZ1Gx4JX6Jk51gD0+FbtoprzjGUaG4 N94fdCdRHFn5YEgsAIEC5xyJCEf0pWT08TnR83SkB8vDruWs8jLWSeLy7nEkR2tviQML 3Pqf8WeK1bpdfIbXMMUQ2yVj82y1Dj3qydNqWTo/HK7Vt1LflupX3pR+LYjhQjUlbMTQ 3Hvg== X-Gm-Message-State: AFqh2krfKpZwIe6pCEHlcIvMzGX8QjSBC4vtWt35YbfXgeip/wSs3vw5 yrGZrhVi0YHCmkHTs/nR1tQ= X-Received: by 2002:a05:600c:5008:b0:3cf:6f4d:c25d with SMTP id n8-20020a05600c500800b003cf6f4dc25dmr54909137wmr.21.1673527190866; Thu, 12 Jan 2023 04:39:50 -0800 (PST) Received: from lucifer.home (host86-164-169-89.range86-164.btcentralplus.com. [86.164.169.89]) by smtp.googlemail.com with ESMTPSA id q1-20020a1ce901000000b003b3307fb98fsm20890797wmc.24.2023.01.12.04.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 04:39:50 -0800 (PST) From: Lorenzo Stoakes To: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Hugh Dickins , Vlastimil Babka , Liam Howlett , William Kucharski , Christian Brauner , Jonathan Corbet , Mike Rapoport , Joel Fernandes , Geert Uytterhoeven , Lorenzo Stoakes Subject: [PATCH v4 1/5] mm: pagevec: add folio_batch_reinit() Date: Thu, 12 Jan 2023 12:39:28 +0000 Message-Id: <9018cecacb39e34c883540f997f9be8281153613.1673526881.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754820942554976986?= X-GMAIL-MSGID: =?utf-8?q?1754820942554976986?= This performs the same task as pagevec_reinit(), only modifying a folio batch rather than a pagevec. Signed-off-by: Lorenzo Stoakes Acked-by: Vlastimil Babka --- include/linux/pagevec.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 215eb6c3bdc9..2a6f61a0c10a 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -103,6 +103,11 @@ static inline void folio_batch_init(struct folio_batch *fbatch) fbatch->percpu_pvec_drained = false; } +static inline void folio_batch_reinit(struct folio_batch *fbatch) +{ + fbatch->nr = 0; +} + static inline unsigned int folio_batch_count(struct folio_batch *fbatch) { return fbatch->nr;