Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3042837rwo; Mon, 24 Jul 2023 05:32:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlE96Gp7AH4dfDl1JRhaH8JYVWYRFGnPKtfVb8gs/Vb6Gt0W35Nces6gyDMf+Pgmmef5U+H9 X-Received: by 2002:a17:902:e743:b0:1b6:a99b:ceb1 with SMTP id p3-20020a170902e74300b001b6a99bceb1mr7913809plf.50.1690201969704; Mon, 24 Jul 2023 05:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690201969; cv=none; d=google.com; s=arc-20160816; b=LQ69d8Qf2tkjOOdEF4qQ9QXf0jQFKmJRKZbAt2WPO8QnAW1nlMy4UMpyxNllSywS2x awJ2Vv1zIAgxWOYj6q5JRLWAK4DRmeKORd3k9qHm7itUp0A8WVHazExYaTiWQ+wtqbLr UYk7yvQ4ZuHHW+1Knz1yiSS08GwwknnmX8ysE0hyNQCtv0SVvFfJisxW5Vm6JJfEusZJ PK7reqjosfqzgjLYE7wL7L9e79KIpdLBDdwfx0K/QtlmRY03inVBlw1zdqNUwt1J0IA7 ypdZFhyuXs3UWiYgcIAyYu7q6qFIJ4/NPwQxvU+MtL3tds4KVx69r6zjZ53m0PywvekG MHtw== 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 :feedback-id:message-id:subject:cc:from:to:dkim-signature:date; bh=xGE6QjHm3ej4AxAX+5EXNKI8Zly3g7JGtmwu3HuYvhg=; fh=QP0Rf+TQA18chmyEIm1Qg63wKCQUSkK1xBm0r+CClfY=; b=wl440WJIe2fo92PvbTfFqJlQK01tuw+CIxTXav7ivegQKZuhL/cyocHmofORx7ToY0 5M11gwnbeJi5FFo2ULFtnIYBwQU1MBXXFxAMgi0tib7TlLXnn319XMqI42ekwuwVbC8e f8be8lcyXXednvxcz6vAeFRICCtU7OFvV5B/gXW6YgWCqIOJdMHza3gLqSVk8+j08t6d kzA36SEzYeFKIOGK0l1z3CK01m57l6UgR6Ud+/t6MIB8WXdVtkhL068l5g5Q00nRM0wc /9XoqFi2YemG6KoCT4apylAlsMF+IXTbbx2LE64j98Lz5jLg99SUk1XR19eeE5OB3ibA tHGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tmb.nu header.s=protonmail header.b=TZIQN1Xh; 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=NONE dis=NONE) header.from=tmb.nu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a17090341c200b001b8698149fbsi9692104ple.477.2023.07.24.05.32.37; Mon, 24 Jul 2023 05:32:49 -0700 (PDT) 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=@tmb.nu header.s=protonmail header.b=TZIQN1Xh; 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=NONE dis=NONE) header.from=tmb.nu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbjGXMQK (ORCPT + 99 others); Mon, 24 Jul 2023 08:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbjGXMQD (ORCPT ); Mon, 24 Jul 2023 08:16:03 -0400 Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C64D4E6D; Mon, 24 Jul 2023 05:15:37 -0700 (PDT) Date: Mon, 24 Jul 2023 12:15:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmb.nu; s=protonmail; t=1690200927; x=1690460127; bh=xGE6QjHm3ej4AxAX+5EXNKI8Zly3g7JGtmwu3HuYvhg=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=TZIQN1Xh+XdlLYOxt0udbKtWWMD3wL/AZ82adZufAkHSESK0ulr1Ld0VhavgA+fhG fpqAmGis3d8uxiftYfSDBGI4vUr1mPrEHSrzJUIyQwCnZgm0YNy76Tje7fsRqomibM uHnIWGMjv9CmjOouHdW6z0ayVwmaCUXnETfPaZuA= To: Mike Kravetz , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org From: Thomas Backlund Cc: Matthew Wilcox , Ackerley Tng , Sidhartha Kumar , Muchun Song , Vishal Annapurve , Erdem Aktas , Greg Kroah-Hartman , Andrew Morton , kernel test robot Subject: Re: [PATCH 1/2] Revert "page cache: fix page_cache_next/prev_miss off by one" Message-ID: Feedback-ID: 19711308:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Den 2023-06-22 kl. 00:24, skrev Mike Kravetz: > This reverts commit 9425c591e06a9ab27a145ba655fb50532cf0bcc9 >=20 > The reverted commit fixed up routines primarily used by readahead code > such that they could also be used by hugetlb. Unfortunately, this > caused a performance regression as pointed out by the Closes: tag. >=20 > The hugetlb code which uses page_cache_next_miss will be addressed in > a subsequent patch. >=20 > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202306211346.1e9ff03e-oliver.sang@= intel.com > Fixes: 9425c591e06a ("page cache: fix page_cache_next/prev_miss off by on= e") > Signed-off-by: Mike Kravetz Should not this one be submitted to 6.4 stable branch too ? git describe --contains 9425c591e06a v6.4-rc7~29^2~1 The other one (hugetlb: revert use of page_cache_next_miss()) of this=20 patch series landed in 6.4.2 Or am I missing something ? -- Thomas > --- > mm/filemap.c | 26 ++++++++++---------------- > 1 file changed, 10 insertions(+), 16 deletions(-) >=20 > diff --git a/mm/filemap.c b/mm/filemap.c > index 3b73101f9f86..9e44a49bbd74 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -1728,9 +1728,7 @@ bool __folio_lock_or_retry(struct folio *folio, str= uct mm_struct *mm, > * > * Return: The index of the gap if found, otherwise an index outside th= e > * range specified (in which case 'return - index >=3D max_scan' will b= e true). > - * In the rare case of index wrap-around, 0 will be returned. 0 will al= so > - * be returned if index =3D=3D 0 and there is a gap at the index. We ca= n not > - * wrap-around if passed index =3D=3D 0. > + * In the rare case of index wrap-around, 0 will be returned. > */ > pgoff_t page_cache_next_miss(struct address_space *mapping, > =09=09=09 pgoff_t index, unsigned long max_scan) > @@ -1740,13 +1738,12 @@ pgoff_t page_cache_next_miss(struct address_space= *mapping, > =09while (max_scan--) { > =09=09void *entry =3D xas_next(&xas); > =09=09if (!entry || xa_is_value(entry)) > -=09=09=09return xas.xa_index; > -=09=09if (xas.xa_index =3D=3D 0 && index !=3D 0) > -=09=09=09return xas.xa_index; > +=09=09=09break; > +=09=09if (xas.xa_index =3D=3D 0) > +=09=09=09break; > =09} > =20 > -=09/* No gaps in range and no wrap-around, return index beyond range */ > -=09return xas.xa_index + 1; > +=09return xas.xa_index; > } > EXPORT_SYMBOL(page_cache_next_miss); > =20 > @@ -1767,9 +1764,7 @@ EXPORT_SYMBOL(page_cache_next_miss); > * > * Return: The index of the gap if found, otherwise an index outside th= e > * range specified (in which case 'index - return >=3D max_scan' will b= e true). > - * In the rare case of wrap-around, ULONG_MAX will be returned. ULONG_M= AX > - * will also be returned if index =3D=3D ULONG_MAX and there is a gap at= the > - * index. We can not wrap-around if passed index =3D=3D ULONG_MAX. > + * In the rare case of wrap-around, ULONG_MAX will be returned. > */ > pgoff_t page_cache_prev_miss(struct address_space *mapping, > =09=09=09 pgoff_t index, unsigned long max_scan) > @@ -1779,13 +1774,12 @@ pgoff_t page_cache_prev_miss(struct address_space= *mapping, > =09while (max_scan--) { > =09=09void *entry =3D xas_prev(&xas); > =09=09if (!entry || xa_is_value(entry)) > -=09=09=09return xas.xa_index; > -=09=09if (xas.xa_index =3D=3D ULONG_MAX && index !=3D ULONG_MAX) > -=09=09=09return xas.xa_index; > +=09=09=09break; > +=09=09if (xas.xa_index =3D=3D ULONG_MAX) > +=09=09=09break; > =09} > =20 > -=09/* No gaps in range and no wrap-around, return index beyond range */ > -=09return xas.xa_index - 1; > +=09return xas.xa_index; > } > EXPORT_SYMBOL(page_cache_prev_miss); > =20