Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1043164pxb; Thu, 23 Sep 2021 16:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoRVAbkDRhT8BD4+JRhjFDLbwggVTsp+Ujpys0sO4UqehDHl6DMwlzz+TfYmzdNqRm1mvU X-Received: by 2002:a05:6602:2182:: with SMTP id b2mr6160821iob.45.1632441047009; Thu, 23 Sep 2021 16:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632441047; cv=none; d=google.com; s=arc-20160816; b=tm+FBvvmgETwgu0RXGXyRd0WCZbn5BBfD7dwr/DMbxRZa8iZqNOZBu6m0rAhmA0sA/ vfmWS4u7ybcQN0CYOT7XXGSISkfzwy/HJ47KSlbrXhfPlPAJ21ebRIuzGyMFqs1pnZ5c /iSTav9mjtZfcUALXXrhFeTwQwClccis24ZONyadhWnFwNxVpp/jZROS4u6OV3c6VGW1 2S+YWx6pn1waIlGV4za1LHKlHonty2Ag0pq4rhw3f7Sr7TNJV5ZfQjFl5bS5WgPVjJu1 FGx6Q0otWfIO7yXi0ZwISOo9w5DpQBn7rRN2z80dIVk+qwCSobksBDjbyRBkVsikfuPs ZLTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=HAmJkHQDJJuagQxHQwV8veFd6rRsJ19PYDz/eTz1rB4=; b=Vm8p2G7pSTMit7veR9kGQmSzR+2Acad/dT/F6BFuWpKrR5JJ4Ww+zhZljxsF30Jkeh RciTlNxwZiOzdUsm4Idx1z6y88mOJfCFaIYYJzqhkG23s/xrc+LjW1/vK419NbRw+X51 6XBDeXGaVWTbuJAwBOowEcNTBHOGrBQify2bmlsmMb13M0yfRCpYmX32ZFN3AHftYgDD wVAGh9mFZrcRbUnSMAoKMRkn+kITaTZRzYNtLd+IoeTIAu1BuBmQx6xEJL/J0JxIwVL0 o/rg/4H0uE9dPtBJ8XL+oZSGt0LN7zdGIXBnqVYGKKAVtol04Fmz19vtC29HmrmMqbaV xEVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=K14UTK5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si9734264jat.53.2021.09.23.16.50.33; Thu, 23 Sep 2021 16:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=K14UTK5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240701AbhIWXug (ORCPT + 99 others); Thu, 23 Sep 2021 19:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243550AbhIWXue (ORCPT ); Thu, 23 Sep 2021 19:50:34 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B52CC061756 for ; Thu, 23 Sep 2021 16:49:01 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id e16so7789665qte.13 for ; Thu, 23 Sep 2021 16:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=HAmJkHQDJJuagQxHQwV8veFd6rRsJ19PYDz/eTz1rB4=; b=K14UTK5w94Mq7Y7d0WepqQG3vE1pbUyxcPERyofOaaiyIVHxbYyK8CI3+1lVRKwB0g UGxogD+nvTWvrZQxq/FLDZ6pHz3qeBwZrqjFVAaElpacm1PBmVp4mepBXiWOr0KLSr0F 7JnWgQzbHfZJLJ6PjzcnIPJBq3MvzmnViyCCEKTVeT6dKhEXNkeosQ+TQYcWcrs+YvcJ 9vT+vOuW8zPALzddhzo4Ap+JWxJf42oQOtPTZSz1tqd4GHEfzK2J1n9TD2I/fu+4Ja8D 9FOg9+FIrgexLSYC7Hj+LAlJ74Zbhod48eyXJrVO5YIftatm4yzHbPA2//17GLe94VsH UOEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=HAmJkHQDJJuagQxHQwV8veFd6rRsJ19PYDz/eTz1rB4=; b=H5LrZ3gzSn2rBvXTCIOPqdwOqzAkZKAOTfrXd9Ye7TIjeDR1vRgI/qTj96DkOb0rXA pZzl5Dt5zFq2OYSTqF6afVd/t4DxyO/85S024D/YRDt+MoSmVy9v7g3FeKKtTGevHXlJ Lw62/cha6U1GOSO2SILmiS2M3xU7wkKbMseg1GrUMYqVh4RYrxAxCknFXK9elsJaIMmk UJI2s0qwy8LIpgt0599Kksp0Cki3p5YJ2tYtk/W2btykYnrAcRWVp9+eDt02bb1dUVlQ 1W9C7bcl75pCjTLJrDhlmTqJinVWsXD1y2raOUDhAg/M3gv0R68jAEbVAbROBK6cFtsi YgWw== X-Gm-Message-State: AOAM530/1tiy3Dviy7/VdBq/JUgbGomApEr4J0RMkpC8JGMGx/mMTZhR NTh9UxNGp6MOhqUBqKMdGXQfAg== X-Received: by 2002:a05:622a:1792:: with SMTP id s18mr1465593qtk.136.1632440940819; Thu, 23 Sep 2021 16:49:00 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id q14sm5171666qkl.44.2021.09.23.16.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 16:48:58 -0700 (PDT) Date: Thu, 23 Sep 2021 16:48:41 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Zi Yan cc: Yang Shi , "Kirill A. Shutemov" , Hugh Dickins , Matthew Wilcox , Kent Overstreet , Linux FS-devel Mailing List , Linux Kernel Mailing List , Linux MM , Johannes Weiner , Linus Torvalds , Andrew Morton , "Darrick J. Wong" , Christoph Hellwig , David Howells , Mike Kravetz Subject: Re: Mapcount of subpages In-Reply-To: <2A311B26-8B33-458E-B2C1-8BA2CF3484AA@nvidia.com> Message-ID: <77b59314-5593-1a2e-293c-b66e8235ad@google.com> References: <20210923124502.nxfdaoiov4sysed4@box.shutemov.name> <72cc2691-5ebe-8b56-1fe8-eeb4eb4a4c74@google.com> <2A311B26-8B33-458E-B2C1-8BA2CF3484AA@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sep 2021, Zi Yan wrote: > On 23 Sep 2021, at 17:54, Yang Shi wrote: > > On Thu, Sep 23, 2021 at 2:10 PM Hugh Dickins wrote: > >> > >> NR_FILE_MAPPED being used for /proc/meminfo's "Mapped:" and a couple > >> of other such stats files, and for a reclaim heuristic in mm/vmscan.c. > >> > >> Allow ourselves more slack in NR_FILE_MAPPED accounting (either count > >> each pte as if it mapped the whole THP, or don't count a THP's ptes > >> at all - you opted for the latter in the "Mlocked:" accounting), > >> and I suspect subpage _mapcount could be abandoned. > > > > AFAIK, partial THP unmap may need the _mapcount information of every > > subpage otherwise the deferred split can't know what subpages could be > > freed. I believe Yang Shi is right insofar as the decision on whether it's worth queuing for deferred split is being done based on those subpage _mapcounts. That is a use I had not considered, and I've given no thought to how important or not it is. > > Could we just scan page tables of a THP during deferred split process > instead? Deferred split is a slow path already, so maybe it can afford > the extra work. But unless I misunderstand, actually carrying out the deferred split already unmaps, uses migration entries, and remaps the remaining ptes: needing no help from subpage _mapcounts to do those, and free the rest. Hugh