Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1560027rwd; Thu, 25 May 2023 14:37:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6No8ZxmvFlC/lbo2gkdfbaFYJHlvgfyC3A5xUFIStMD2GhvuVRgzj00ZYEbL0qmAu764L5 X-Received: by 2002:a17:903:2092:b0:1ab:1a6:34bc with SMTP id d18-20020a170903209200b001ab01a634bcmr116093plc.9.1685050635095; Thu, 25 May 2023 14:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050635; cv=none; d=google.com; s=arc-20160816; b=RhSOsYjqc3AlKP/1VMjazDGAySihAkC6PSb6ksWgWfe0jJ8qenhsqEfUfnG/X1Cw+y u0XBWvvUn1qwHvK9aw7wNAHf859Kudh18tEpkph2YiBgHuCfRcIj6WlXhkDX6Mus+fLn KkwQbPEasCHzcNtwHXXFIS6FJDuxTzwgr4qQykP3P9Tge2n3U/Yz51ay25/D11N/cIiu 0MuNKVNsfzt1qVbeR0TrPmd16I8CjkyQb60hUAxcH+3znt/i9p1DyNI2OxjliS+blje7 n4i3Wr9/4bsrB1GizrPKCxcD/EeWo8PYDYgryiqOGL3apEp8lQ5ssNojAsoTt38nB5bU 20bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=to7pioPumMAlTGKORpUeQh361tXFOrBDpzDI+Fvoclg=; b=pQKsB/4q5Ql8LeDO30AK9welskJf92Cig9oqodZ2KhOt6+v5rpqAWv2kzqX8uyUk/t BSyZmx9r51xrEOoBOsYvodQL+iAn4tBSevN7kNP6K7bsL6KUEZsuoa1Mu5CvDMbodbeG y+OiJH4czX92f3OYWyD1Cw+yZB4n+lBQIwn/L0krRxDhGxIxV4Sxic0++uE67aVYREc7 ZFq6oabIlmPlVWYrAkXE8IV6caRT596tU7lJUSt03+2WNhbVo0T7H8Omm2ag29HaFTbt r5Lq1qi4RpOW2yzQeZ1kV8DOhgDIAm1Hy8+3g1Uz+7OWcdaYCs5Sgq89NjNwT0ZDnO9J NIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tRdLECtj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a170903024700b0019e57f5a5aesi2421511plh.567.2023.05.25.14.37.01; Thu, 25 May 2023 14:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tRdLECtj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241424AbjEYVbz (ORCPT + 99 others); Thu, 25 May 2023 17:31:55 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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().