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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFDFDC433F5 for ; Sun, 19 Dec 2021 22:27:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F46E6B0071; Sun, 19 Dec 2021 17:26:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A28B6B0073; Sun, 19 Dec 2021 17:26:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06A1B6B0074; Sun, 19 Dec 2021 17:26:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id EC64C6B0071 for ; Sun, 19 Dec 2021 17:26:56 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B3C9582FC9 for ; Sun, 19 Dec 2021 22:26:40 +0000 (UTC) X-FDA: 78935979360.27.8AE4DC3 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id CC324A0035 for ; Sun, 19 Dec 2021 22:26:33 +0000 (UTC) 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: X-Rspamd-Queue-Id: CC324A0035 X-Stat-Signature: t9tk1oz94sa66t3hme3s11qifkh5sm84 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=eiVsACMV; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam02 X-HE-Tag: 1639952793-97332 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: 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));