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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0851AC4332F for ; Sun, 19 Dec 2021 22:26:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236795AbhLSW00 (ORCPT ); Sun, 19 Dec 2021 17:26:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231572AbhLSW0Z (ORCPT ); Sun, 19 Dec 2021 17:26:25 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F83BC061574; Sun, 19 Dec 2021 14:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WrMo2FbvfTHE2R5AHHoM6zUbBYPY7DJveiU7/Kb21KM=; b=eiVsACMV9Ai87OPY8MkPsR+PEn k8h/WwoF9VdHtxnfNWZdzV76qz/DNUUT/ZBihkD8ApttdV7ghAVkLsH6lPgmPqlQ3jZ0o5NRP04r7 u/e5kJ4TMPH71pJubK9zyxijsEaWKMlrhuGgUX+IBEJN+0Y3y40IOcLmPwoGtV6nT77ByOry+PGOs 87uWJ5piTe8lkdo5Oy/kUPieXahmcFVBao4EwxRfhttHqahlp7Ey8sK5Hs4Ip804LmGYjbbgkC3tj 5EFiSoKQUjd9swbgNj2FnCcMSQ8eWLmC40xHh26yMA/kTUxWkhlu06++c2LpsJVzrJDr3UGNyAMyB 90IEUvhw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mz4dB-0014v5-Pz; Sun, 19 Dec 2021 22:26:13 +0000 Date: Sun, 19 Dec 2021 22:26:13 +0000 From: Matthew Wilcox To: Linus Torvalds Cc: David Hildenbrand , Nadav Amit , Jason Gunthorpe , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Vlastimil Babka , Jann Horn , Michal Hocko , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Message-ID: References: <5A7D771C-FF95-465E-95F6-CD249FE28381@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 19, 2021 at 02:12:04PM -0800, Linus Torvalds wrote: > On Sun, Dec 19, 2021 at 2:02 PM Matthew Wilcox wrote: > > > > I'd like to get rid of ->mapcount for file pages too. And those are > > definitely never mapped in the majority of cases. > > Fair enough. > > You'd probably be better off checking "is this mapping mapped" though. > Because otherwise you have to get the page lock to serialize each > page. Truncate already has the page locked, eg truncate_inode_pages_range() find_lock_entries() truncate_cleanup_page() if (page_mapped(page)) unmap_mapping_page(page) I think anyone calling unmap_mapping_page() really ought to have the page lock. Oh, we actually have an assert already to that effect ;-) VM_BUG_ON(!PageLocked(page));