From patchwork Wed Jun 21 16:45:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13287671 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 7ED41EB64D8 for ; Wed, 21 Jun 2023 16:46:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E4688D000E; Wed, 21 Jun 2023 12:46:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46BC78D000D; Wed, 21 Jun 2023 12:46:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2492D8D000E; Wed, 21 Jun 2023 12:46:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 153D78D000D for ; Wed, 21 Jun 2023 12:46:11 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DDA9CB02CA for ; Wed, 21 Jun 2023 16:46:10 +0000 (UTC) X-FDA: 80927332500.23.7BAE5D5 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 0883440029 for ; Wed, 21 Jun 2023 16:46:08 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=OU4HmcXW; dmarc=none; spf=none (imf01.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=1687365969; 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=KFMiCla2naG7Z7vKPwGKVD4TrVn4emFE0PLxxevs+7o=; b=hQ6P6C/mTRntT7pXksT1B6Rl+uYQwZkfSDqwgqIhGUwXA32qzooQUOEl8Ie2L6+iY7rQ+8 EA1ZYwJd5j6eV9tw/JKfq8brs6oIk4zMLhJF+kXN8YEsTzjFRk7yyfGkuobuKR4QQOUYjL rZuBVVRmoIURazN1zbqZmIo3E9VRqP0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=OU4HmcXW; dmarc=none; spf=none (imf01.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=1687365969; a=rsa-sha256; cv=none; b=qi1RBfKyGDZnvYYgsBBB+WNRSTAnytkUrjGstybQUlpCcSgdoOjIJxPOZ5A3F5sC0f+F+T HQQtozVtiFl/5rXKOrLxDe1HooRHnXCUvfOZKDyOgIssyN5FB3b6ZCf4QAng3ueLh5Ilv6 nGO/UCc/1q4Pcv2YK6ol2dz2MbZKNCY= 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=KFMiCla2naG7Z7vKPwGKVD4TrVn4emFE0PLxxevs+7o=; b=OU4HmcXWzyUGQD65hDOdwkgu0o u74l9DMZxcBXT5V4Z5qLLe5pROXO6krjW5ruc1DT0SkscC1GAv6CUiRHqoT/xZNB+FTYdY7HTZcSC 1nPv6XnNmEo7hrUJxM01iosMG8Y0Ym2VcY6jvvzCBkvQC7lZJfWEJjt8YGSGMlqEn7izRDRm51hz1 GMTsyqcMH1J1dyYFMGFeU3Saag7AZyuOX2CkLBm+3ksa29C3VbudjYZzIgY5yxIiJcoHDGi0dytI4 BSi9r/ik6bNx2dBlS0BKcqh1/yQ1YIwWVl75bC6VUoMpy4h0Khgb2dDFrfbmsM3CyCJYXba2lPTTt z9KQ53Ag==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qC0y1-00EjDi-Cc; Wed, 21 Jun 2023 16:46:01 +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 02/13] mm: Add __folio_batch_release() Date: Wed, 21 Jun 2023 17:45:46 +0100 Message-Id: <20230621164557.3510324-3-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: 0883440029 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: jk5mzst39inacjxkstbhcxo1hkjomfab X-HE-Tag: 1687365968-253639 X-HE-Meta: U2FsdGVkX1/w2VlcEUCvO5SH8Tbn3SS2GWxnWnUjlLvB5KSEF82G29qnskVc/NM3TBnzQv90wCVMJbfIk/BTGB5xjQX13umL2EY+kvyNvCf3zavsU8it2gz+uGxw5Ppdo7g3VM89LW+EcT3TmrjporLzGGS0OaqEGpGAWR/5qeVZABvr/n8P7SF8PXc7doRwH9egsaefqbyc18gxRjzhNl62t5Zq/BreTUOvZxpRkeIpTEsaiFbcYH4B57XRZC/TDItAno/cFYIYwW5E6M71BwTMMBXin6ui3wdQjnizQfqZYi8L8JEznRloEem07Ha0zwL+Qh3mTafCmC+rFvoO6Dy2wjwkIGc/VMhk6PqvFHqncpEH6WZL4c1tY8VV8mLhd7tspFwIz+l/n7X2fFPy/fAx/24uE8DiPx24AAfmM8HivUjwSnzbpvQnSYb9/tKihCkWODcAKTh+NNNVvghqKAls4/aygCNbvLQmqt4aqt3wkWrJ829qXtinXZ8yk72x2Rjz27W6klrZaiJqV2oXl2hBzBpQwJBQbPnrQk+H8VblzbV4uUhHV8k/52dqBG6rbIKOu+zjn36TLKWhQm5IzrF8C/ZW93EIDIBnAee5ImrPY87K0ftV+y2O2R2v0mIdjbgeaKywxcKrnlDMA89rmuXvDXujzYOEjBoOtvZVveW5aiNjoiRTrF3tR0wuFQSynXh2ExwjLf5jy0nkYaOUlIOSDA88M1IbQekES90EikEdlW/qPw91f6NROH0CyT/Wqw+iP4o1ffWdKpBIhFvJxOsdAz1Y4rds0qWoc7m4UtbdjIML0VRC5f2q8CeiTHrPC+25mYQoOPjPX6T9asB47pMh59wX8rQCdSjIRw1KdXL7eIYFhS4ZCkqWNs/bfBN+ACdu7XHQcMWAAVQsGyG19byROXttxs891BqFeUARJqqBJZZIFLPK6HNlb3NwhbIw1pBMrL57ZJAfLq2uC9H n4WDDIWN w0IU+KHnYMHsgYgxXs4JhdGqId7U4ZfjM4rAiQxtWEzBoqZ4Zt3H5DP3Ev6loEmW4W18ItqBND03QuA7w0L2SJu36JfWTjVMraP356XzXhhJPwxxlWuhorQ16lnbgBBljt+LNCk3s132FwsvcduwChfdT4pYD95oBMlg869uSxtQZHS9FDExXbfLve664b7t8lqSB+o/X9JBh92FyzS/9INELtzfnaK/xuQFP 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 performs the same role as __pagevec_release(), ie skipping the check for batch length of 0. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagevec.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index f582f7213ea5..42aad53e382e 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -127,9 +127,15 @@ static inline unsigned folio_batch_add(struct folio_batch *fbatch, return fbatch_space(fbatch); } +static inline void __folio_batch_release(struct folio_batch *fbatch) +{ + __pagevec_release((struct pagevec *)fbatch); +} + static inline void folio_batch_release(struct folio_batch *fbatch) { - pagevec_release((struct pagevec *)fbatch); + if (folio_batch_count(fbatch)) + __folio_batch_release(fbatch); } void folio_batch_remove_exceptionals(struct folio_batch *fbatch);