Message ID | 20221017161800.2003-1-vishal.moola@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1537744wrs; Mon, 17 Oct 2022 09:28:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Yop69ZVXiylH26BtSEJ3ZVo/9Epdg6NcAZoFRdl8Yxp/Vrmm3LkFibiBcHVy0M8xvpbQ9 X-Received: by 2002:a17:903:2449:b0:186:1269:929c with SMTP id l9-20020a170903244900b001861269929cmr125344pls.37.1666024130649; Mon, 17 Oct 2022 09:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666024130; cv=none; d=google.com; s=arc-20160816; b=hHbbDWShp5f1f0pzolACZAt8tE5tEz9+Ue3jUviUTKFutTuQrudYGjs5HXIAtV6v2T uc7TGTfyMfV7MLh6eHUYZWD8FIIylTOQIzPPdlxo4LvU1oN2/v4UsJWS+tDb0ybD+OeI Kjy9cLlS9ZktP2bruIHpzXa2L7WFEeIOQ1Sa9gwDN+Oh4Gq/JLMLQCEdrO0pqgFPla+A th9fPpYr72H5YfqVmztfBzI/1VldletDLZ8VMkge25V6KjGFS/wQ2JJpqqQsOC9YYRer MgKPkx8wPJ48QuvmseB7EV3ycgIMZsrfhvF9mbYmhZakt8XT2I1YCQma3X9AT3hZdT60 h2lA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nPOgLKtqJqc/KkUndkqLjqrqFd6Qi0PDVLbeuKh7FTw=; b=OZCMmmwHBJkbYtisWHrW/8L/LxOZUuxyxfpjvWyrFAlcvN1uSbN0LlXcDeBw0ZyhRA k/j7RuWRU7bS5azLjjghyAiB3tqT7rRrhIpX5J5GOTjV0ZrYG0PKp7mn2FYULgSEzK2e 9uOtvAM6uWwMqcvJhgB8i2PukDM+7mfoyaxS08DKjEeSzKA/HXGjqjOYXsVAvgAdjZ7v 6O48RHu6pLU7tyrDkR3vYsdyAJNkdEEQLpg5Y4v4rMeo/TYN4IDAs/lq+tG5HFyj+YKF bBI0aWpF781G1chGI399PZiqsMT17nhaEkVxC+BJK0NnCFyr5mVVOzFNzPW1ciDoxwj9 HtVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4cfhBfN; 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 x17-20020a656ab1000000b004347b49d045si13287423pgu.631.2022.10.17.09.28.36; Mon, 17 Oct 2022 09:28:50 -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=@gmail.com header.s=20210112 header.b=q4cfhBfN; 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 S230272AbiJQQSI (ORCPT <rfc822;kernel.ruili@gmail.com> + 99 others); Mon, 17 Oct 2022 12:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiJQQSG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Oct 2022 12:18:06 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B9E6CF44; Mon, 17 Oct 2022 09:18:05 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id x31-20020a17090a38a200b0020d2afec803so11454007pjb.2; Mon, 17 Oct 2022 09:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nPOgLKtqJqc/KkUndkqLjqrqFd6Qi0PDVLbeuKh7FTw=; b=q4cfhBfNy4i8qzlQX6+OteLtFU9IPky21iCQeSAduA33cWBF/akGv01p4X2WqaAypq Qz9U3QYo9P17o/x1Wnj5iIuERGQJvlMW5/jyUthYy+SNEesjFzSnYy6uw5cgR1qPoKTc Ekn9Y0Oaatou+qg4G0Eaxf7nxzxpZmDH796Qamf9kkTd2ptegwWHOo+bpOHjBYZx5NOp 9Ci57iNswficoBuLd6IX2pDr7uStAaWB+K6W5ISfXQ+xVI0D0tzRJBPUBgs5igMaa7Am ZXRfdFClTAuFsgKi8GPPg5O4Ocon3+Bh8simIG5nuTt3/bDWk5eKXuim1Y8+yy0d6/Ue QKYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nPOgLKtqJqc/KkUndkqLjqrqFd6Qi0PDVLbeuKh7FTw=; b=H/P5Lstv8FSX1G8ZPwZpFxA3az55C2VpyoJAwL9vTrAv3YBXmNIixjDy8RucXp957B 3wmuMeRx85BN2EAQGwN6+sx9a2Mh9E6NlWkcaUqhtXO1QlFss1bO/NnpEe5406XWPEVY pnjLg7W5MFqblEM6rKRRL4l5VTMphs4O8nrwXzkZZ+/OUhXXNsMfzMpNyXk86kf/bC0z gSjBbRPCH+OlpMPaVRFoD1wro3m36NamOXeb8XAPc9+i0kMG0zvPsJg/2gmErve7lNFp BHgN4Y/hG1oBoQMuIWJ6EeSfNTrGZB3lVdeSbALwPtVYx/GMbEsqp0mFtW4Po04k9LSE BkHQ== X-Gm-Message-State: ACrzQf1YOcCOjllaRPP2az0Neh/TghNoUBXmvkf/53rYx0UEHwxZbNWT x9t2sz8yjP94rhEYB1GNnCo= X-Received: by 2002:a17:90a:890b:b0:20d:981a:a5b5 with SMTP id u11-20020a17090a890b00b0020d981aa5b5mr30088023pjn.186.1666023485280; Mon, 17 Oct 2022 09:18:05 -0700 (PDT) Received: from vmfolio.. (c-76-102-73-225.hsd1.ca.comcast.net. [76.102.73.225]) by smtp.googlemail.com with ESMTPSA id z22-20020a62d116000000b0055f209690c0sm7272326pfg.50.2022.10.17.09.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 09:18:04 -0700 (PDT) From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com> To: akpm@linux-foundation.org Cc: willy@infradead.org, hughd@google.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" <vishal.moola@gmail.com> Subject: [PATCH v3 0/2] Rework find_get_entries() and find_lock_entries() Date: Mon, 17 Oct 2022 09:17:58 -0700 Message-Id: <20221017161800.2003-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746952918979617305?= X-GMAIL-MSGID: =?utf-8?q?1746952918979617305?= |
Series |
Rework find_get_entries() and find_lock_entries()
|
|
Message
Vishal Moola
Oct. 17, 2022, 4:17 p.m. UTC
Originally the callers of find_get_entries() and find_lock_entries() were keeping track of the start index themselves as they traverse the search range. This resulted in hacky code such as in shmem_undo_range(): index = folio->index + folio_nr_pages(folio) - 1; where the - 1 is only present to stay in the right spot after incrementing index later. This sort of calculation was also being done on every folio despite not even using index later within that function. These patches change find_get_entries() and find_lock_entries() to calculate the new index instead of leaving it to the callers so we can avoid all these complications. --- v3: Fixed a typo in commit messages Shifted calculations to after the rcu_read_unlock() v2: Fixed an issue when handling shadow entries Dropped patches removing the indices array; it is required for value entries Vishal Moola (Oracle) (2): filemap: find_lock_entries() now updates start offset filemap: find_get_entries() now updates start offset mm/filemap.c | 28 +++++++++++++++++++++++----- mm/internal.h | 4 ++-- mm/shmem.c | 19 ++++++------------- mm/truncate.c | 30 ++++++++++-------------------- 4 files changed, 41 insertions(+), 40 deletions(-)