Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp19561ybk; Fri, 8 May 2020 12:54:21 -0700 (PDT) X-Google-Smtp-Source: APiQypLAmUyik5A48u1rFmDmSk64AIgXa2ncuwlpCTa6AECVYaIs3HHQtEeI4WG4aNP4xyp/Z2XS X-Received: by 2002:a17:906:78c:: with SMTP id l12mr3110534ejc.189.1588967661590; Fri, 08 May 2020 12:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588967661; cv=none; d=google.com; s=arc-20160816; b=FvuO3uPi/TZsTpt5RHtPMTK6WI96G5WtfpFD7LiX2/JJb/kD4CM1ICoQ0E2Way91ZS mOVw4U2hYz0z22SW75iKUnS6k7mH6raYGHbFNDClVjTE/QTq4/NPt43Dg4GcgV2vpGM9 RXTYYEsadDaSfy5Jf2sSxrsxnLvYNMJXWO2c+Q0qBXcSi+Qbiu3S/a+MvJGOG7feI7oU OxnW6tXHgtGt6aBUcjtasLx6Wuf2E3YP4BRW1eo2QBFE6Fsomv5msCczUtq1BzfUMj+H SMoHSkgUrf0CpenXdeNy08GZ5W1Tcv832isx2+XxWXa7r9wdKMmJI0gh3fBpRZ49TWVx lSjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KcgYNwHR4X2PeGfALjwtWrgTu00911mmVfyHtPsB5IE=; b=Z4EQIRjsHTyqMvOgiL5UH1dYUdB/Mwx98QtmcdjgYcHoFcPaGolvYr/8mwD7kVgeOr OhEX65uo4D1ZOx0b4GlR1K011Rz1vWgNzwt/hkIEKKpfSARWqxdVks2n6vXTY8qKP6l1 UsKHRWw0oKhqSyY5rbShvjxLdxM3+lgbkcD3+sNNjaLZuK3fSSkhZaRwxVlP4VE489Rn l1tnu1OGXM4ylMG/poVgjTptNH8hjOMMyMuuHhuLtRjFhbW6/Z3sB4V0s8Zi5qAvhn5o LfEWDqn2m18AszcW9bb4WF/pRA6rAB1wV6Te15bVaQUGmuDUMgZ0wNQvkFgUvE3Pk9EM xo/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si1563220ejd.76.2020.05.08.12.53.48; Fri, 08 May 2020 12:54:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgEHTve (ORCPT + 99 others); Fri, 8 May 2020 15:51:34 -0400 Received: from verein.lst.de ([213.95.11.211]:54154 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbgEHTve (ORCPT ); Fri, 8 May 2020 15:51:34 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6EAA068C7B; Fri, 8 May 2020 21:51:30 +0200 (CEST) Date: Fri, 8 May 2020 21:51:30 +0200 From: Christoph Hellwig To: Ralph Campbell Cc: nouveau@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , Ben Skeggs , Andrew Morton , Shuah Khan , willy@infradead.org Subject: Re: [PATCH 4/6] mm/hmm: add output flag for compound page mapping Message-ID: <20200508195129.GA19740@lst.de> References: <20200508192009.15302-1-rcampbell@nvidia.com> <20200508192009.15302-5-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508192009.15302-5-rcampbell@nvidia.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 12:20:07PM -0700, Ralph Campbell wrote: > hmm_range_fault() returns an array of page frame numbers and flags for > how the pages are mapped in the requested process' page tables. The PFN > can be used to get the struct page with hmm_pfn_to_page() and the page size > order can be determined with compound_order(page) but if the page is larger > than order 0 (PAGE_SIZE), there is no indication that the page is mapped > using a larger page size. To be fully general, hmm_range_fault() would need > to return the mapping size to handle cases like a 1GB compound page being > mapped with 2MB PMD entries. However, the most common case is the mapping > size the same as the underlying compound page size. > Add a new output flag to indicate this so that callers know it is safe to > use a large device page table mapping if one is available. Why do you need the flag? The caller should be able to just use page_size() (or willys new thp_size helper).