From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9A33C433DB for ; Sun, 24 Jan 2021 01:50:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B453022D06 for ; Sun, 24 Jan 2021 01:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbhAXBua (ORCPT ); Sat, 23 Jan 2021 20:50:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:49930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbhAXBuW (ORCPT ); Sat, 23 Jan 2021 20:50:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DF2022D58; Sun, 24 Jan 2021 01:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1611452985; bh=fn3GlgPW3jCM6QRs+Gn9yKxptWrhX0kVIHptxvoFF3E=; h=Date:From:To:Subject:From; b=BR/tdwMHM8dPOzDYwGx5BdK8pnXmNAx7XkZ87JCw/H32F4nKaAOx+Yb6CkuO5j1kx kBInrrmvXy1yzU9FTnGqIYhA6LRYZbzzWy8/L+MdJqA924Eby5JdgU9b+cI7SDdFCg 3OV+BsS3THbv/bzug1aAbPRmoX9IpqZb9HUOjQDA= Date: Sat, 23 Jan 2021 17:49:44 -0800 From: akpm@linux-foundation.org To: hch@lst.de, kent.overstreet@gmail.com, linmiaohe@huawei.com, mm-commits@vger.kernel.org, willy@infradead.org Subject: + mm-filemap-dont-relock-the-page-after-calling-readpage.patch added to -mm tree Message-ID: <20210124014944.UJ4zZX5aM%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm/filemap: don't relock the page after calling readpage has been added to the -mm tree. Its filename is mm-filemap-dont-relock-the-page-after-calling-readpage.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-filemap-dont-relock-the-page-after-calling-readpage.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-filemap-dont-relock-the-page-after-calling-readpage.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" Subject: mm/filemap: don't relock the page after calling readpage We don't need to get the page lock again; we just need to wait for the I/O to finish, so use wait_on_page_locked_killable() like the other callers of ->readpage. Link: https://lkml.kernel.org/r/20210122160140.223228-17-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Kent Overstreet Reviewed-by: Christoph Hellwig Cc: Miaohe Lin Signed-off-by: Andrew Morton --- mm/filemap.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/mm/filemap.c~mm-filemap-dont-relock-the-page-after-calling-readpage +++ a/mm/filemap.c @@ -2208,23 +2208,16 @@ static int filemap_read_page(struct file error = mapping->a_ops->readpage(file, page); if (error) return error; - if (PageUptodate(page)) - return 0; - error = lock_page_killable(page); + error = wait_on_page_locked_killable(page); if (error) return error; - if (!PageUptodate(page)) { - if (page->mapping == NULL) { - /* page truncated */ - error = AOP_TRUNCATED_PAGE; - } else { - shrink_readahead_size_eio(&file->f_ra); - error = -EIO; - } - } - unlock_page(page); - return error; + if (PageUptodate(page)) + return 0; + if (!page->mapping) /* page truncated */ + return AOP_TRUNCATED_PAGE; + shrink_readahead_size_eio(&file->f_ra); + return -EIO; } static bool filemap_range_uptodate(struct address_space *mapping, _ Patches currently in -mm which might be from willy@infradead.org are mm-debug-improve-memcg-debugging.patch mm-filemap-rename-generic_file_buffered_read-subfunctions.patch mm-filemap-remove-dynamically-allocated-array-from-filemap_read.patch mm-filemap-convert-filemap_get_pages-to-take-a-pagevec.patch mm-filemap-use-head-pages-in-generic_file_buffered_read.patch mm-filemap-pass-a-sleep-state-to-put_and_wait_on_page_locked.patch mm-filemap-support-readpage-splitting-a-page.patch mm-filemap-inline-__wait_on_page_locked_async-into-caller.patch mm-filemap-dont-call-readpage-if-iocb_waitq-is-set.patch mm-filemap-change-filemap_read_page-calling-conventions.patch mm-filemap-change-filemap_create_page-calling-conventions.patch mm-filemap-convert-filemap_update_page-to-return-an-errno.patch mm-filemap-move-the-iocb-checks-into-filemap_update_page.patch mm-filemap-add-filemap_range_uptodate.patch mm-filemap-split-filemap_readahead-out-of-filemap_get_pages.patch mm-filemap-restructure-filemap_get_pages.patch mm-filemap-dont-relock-the-page-after-calling-readpage.patch mm-make-pagecache-tagged-lookups-return-only-head-pages.patch mm-shmem-use-pagevec_lookup-in-shmem_unlock_mapping.patch mm-swap-optimise-get_shadow_from_swap_cache.patch mm-add-fgp_entry.patch mm-filemap-rename-find_get_entry-to-mapping_get_entry.patch mm-filemap-add-helper-for-finding-pages.patch mm-filemap-add-helper-for-finding-pages-fix.patch mm-filemap-add-mapping_seek_hole_data.patch mm-filemap-add-mapping_seek_hole_data-fix.patch iomap-use-mapping_seek_hole_data.patch mm-add-and-use-find_lock_entries.patch mm-add-and-use-find_lock_entries-fix.patch mm-add-an-end-parameter-to-find_get_entries.patch mm-add-an-end-parameter-to-pagevec_lookup_entries.patch mm-remove-nr_entries-parameter-from-pagevec_lookup_entries.patch mm-pass-pvec-directly-to-find_get_entries.patch mm-remove-pagevec_lookup_entries.patch