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 81972C4332F for ; Wed, 2 Nov 2022 13:04:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C3718E0002; Wed, 2 Nov 2022 09:04:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04C298E0001; Wed, 2 Nov 2022 09:04:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2FB48E0002; Wed, 2 Nov 2022 09:04:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D1B368E0001 for ; Wed, 2 Nov 2022 09:04:57 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A5A104124C for ; Wed, 2 Nov 2022 13:04:57 +0000 (UTC) X-FDA: 80088522234.29.F5277CE Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf18.hostedemail.com (Postfix) with ESMTP id D82601C000C for ; Wed, 2 Nov 2022 13:04:56 +0000 (UTC) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A2D2ddc010456; Wed, 2 Nov 2022 13:04:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=fBMsh0qWbBU7AjpN4D6Xh6IAPjIyRElHVfVtLuyIqtw=; b=AWLQqLrM1IqlDvxrj73BO24QRgwdmJ1KSu3MLlzZOutY/VnR9soOC/vST6oijvQOQ7aD vxeyw4mlTcy9FmXeoOyLi41H7MZEXv4iRLLCvBZE/fYMnTlEOzSm/9+spWwkT1v5pcD4 qeKBZ9gU0K37wYS7I6cvcoPMJN2XcejEPOsh93k6Dy6ppI1Ceh6IHHDGxPcMGZBVl6u4 WxODZRFFRhHI/ds2NJUXvmkE82J8X6+O58xGe5gVWY3GNJhVzre25QSmmDar7Ve33znz W0VrE7t5+pUTrlIzudj0NV36gu1UidW/g/LmVPhSnXuIFrd+S+Q8PGhf0G7BpzfCiAI3 mQ== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kkqxwjnbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 13:04:26 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2A2CoErs019765; Wed, 2 Nov 2022 13:04:25 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01wdc.us.ibm.com with ESMTP id 3kgut9tucc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 13:04:25 +0000 Received: from smtpav01.wdc07v.mail.ibm.com ([9.208.128.113]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2A2D4OSZ53412310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Nov 2022 13:04:24 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E491858059; Wed, 2 Nov 2022 13:04:23 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEAE358068; Wed, 2 Nov 2022 13:04:19 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.108.109]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Nov 2022 13:04:19 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Dan Williams , linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , "Darrick J. Wong" , Jason Gunthorpe , Christoph Hellwig , John Hubbard , david@fromorbit.com, nvdimm@lists.linux.dev, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3 04/25] fsdax: Introduce dax_zap_mappings() In-Reply-To: <166579183976.2236710.17370760087488536715.stgit@dwillia2-xfh.jf.intel.com> References: <166579181584.2236710.17813547487183983273.stgit@dwillia2-xfh.jf.intel.com> <166579183976.2236710.17370760087488536715.stgit@dwillia2-xfh.jf.intel.com> Date: Wed, 02 Nov 2022 18:34:17 +0530 Message-ID: <87tu3h1p9q.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: WqL3YTkfmvD5OiTzJZde57cM9Nmht9a8 X-Proofpoint-GUID: WqL3YTkfmvD5OiTzJZde57cM9Nmht9a8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-02_09,2022-11-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 clxscore=1011 bulkscore=0 mlxlogscore=799 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211020082 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667394297; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fBMsh0qWbBU7AjpN4D6Xh6IAPjIyRElHVfVtLuyIqtw=; b=wDXRa1G8TTmSMsL5rF3BDmg61SADKAjpxlSOy8ItzoYUI4C1l3fODv2syrbFHLHxnvuLMB 5UGUxIO5OGwAOnRueHFVNd0YqqTSUE880bFPMgZCwvigRXym1KQyKU8in5EonBFbqE1+k1 seI7aKfL8+nC64KFTWBdkmHIErYGG3Q= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=AWLQqLrM; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf18.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667394297; a=rsa-sha256; cv=none; b=syUivXsjWr99jjLRtMtDhmdeadeimIW/nBnGGysECK3kXmZgbQ2RmiNFTEoSj7W54jAKcM o3quKriP2ZSTYfiXN5Btt6B1/M9ppno8+gHqXHqSn7dz8rWlZkWDQ7EZhKXDEBpTozZZaC uNAUrxiXQYu/gqVMMabQpLcquusRNw8= Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=AWLQqLrM; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf18.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D82601C000C X-Stat-Signature: jg81nanmcpgn43kfkqgj71m8jhejan36 X-HE-Tag: 1667394296-901886 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: Dan Williams writes: > Typical pages take a reference at pte insertion and drop it at > zap_pte_range() time. That reference management is missing for DAX > leading to a situation where DAX pages are mapped in user page tables, > but are not referenced. > > Once fsdax decides it wants to unmap the page it can drop its reference, > but unlike typical pages it needs to maintain the association of the > page to the inode that arbitrated the access in the first instance. It > maintains that association until explicit truncate(), or the implicit > truncate() that occurs at inode death, truncate_inode_pages_final(). > > The zapped state tracks whether the fsdax has dropped its interest in a > page, but still allows the associated i_pages entry to live until > truncate. This facilitates inode lookup while awaiting any page pin > users to drop their pins. For example, if memory_failure() is triggered > on the page after it has been unmapped, but before it has been truncated > from the inode, memory_failure() can still associate the event with the > inode. > > Once truncate begins fsdax unmaps the page to prevent any new references > from being taken without calling back into fsdax core to reestablish > the mapping. The gup path should now check dax_is_zap()? Where do we prevent new referenced from being taken? -aneesh