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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE67C7EE29 for ; Thu, 25 May 2023 21:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241538AbjEYVb4 (ORCPT ); Thu, 25 May 2023 17:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233757AbjEYVby (ORCPT ); Thu, 25 May 2023 17:31:54 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4D11B3 for ; Thu, 25 May 2023 14:31:40 -0700 (PDT) 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=to7pioPumMAlTGKORpUeQh361tXFOrBDpzDI+Fvoclg=; b=tRdLECtjpF0/xZKIdrNOLP93Bn bdu58jxSyqv95/kwtDk6ZnWYhoZy8EsbcBGnBw5WmAF2SUa9W5nMMiZ3zFRbtikrcY3MhfubZOC2q a4NcLl7xysf0q00JKf9RDXjqyKIDM7jjLztn3QVdh1U9J2zeS4Fl1zTTQBq/iRWlZKfWlhQfgsrSp krTH6naUlXufrN3WJ5CNY0/Nz5LgdIIysjweaBXrvstuZLFkfmjhMoCcN0GQB63Z/2O+Lm4TGCQuE pJ2/AqvieLBelwv49KgNBbvk30a5LqE6sz21L6asEvhwqayv9AACbXlH1xNuwW4XuGc706ORXV3fQ /S8CwKPw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1q2IYF-00FjtV-LU; Thu, 25 May 2023 21:31:15 +0000 Date: Thu, 25 May 2023 22:31:15 +0100 From: Matthew Wilcox To: Steven Sistare Cc: Khalid Aziz , akpm@linux-foundation.org, david@redhat.com, ying.huang@intel.com, mgorman@techsingularity.net, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Khalid Aziz Subject: Re: [PATCH v4] mm, compaction: Skip all non-migratable pages during scan Message-ID: References: <20230525191507.160076-1-khalid.aziz@oracle.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 Thu, May 25, 2023 at 09:45:34PM +0100, Matthew Wilcox wrote: > > > Isn't "long term pinning" the wrong description of the problem? Long term > > > pins suggest to me FOLL_LONGTERM. I think this is simple short term > > > pins that we care about here. > > > > vfio pins are held for a long time - Steve > > So this is a third sense of "pinned pages" that is neither what > filesystems nor the mm means by pinned pages, but whatever it is that > vfio means by pinned pages? If only "pin" weren't such a desirable > word. Can somebody explain to me in small words what a vfio pin looks > like because I've tried reading vfio_iommu_type1_pin_pages() and I > don't recognise anything there that looks like pinning in either of > the other two senses. Oh, I think I found it! pin_user_pages_remote() is called by vaddr_get_pfns(). If these are the pages you're concerned about, then the efficient way to do what you want is simply to call folio_maybe_dma_pinned(). Far more efficient than the current mess of total_mapcount().