Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3253717ybc; Thu, 14 Nov 2019 06:25:20 -0800 (PST) X-Google-Smtp-Source: APXvYqw885qCa5AeWOeDor2zeLacv0oDzqLq4LTOGtIMtmKB0KSoYzKTMCE8YRcCtYPcBMjP7kvJ X-Received: by 2002:a17:906:2e5a:: with SMTP id r26mr8696555eji.283.1573741520744; Thu, 14 Nov 2019 06:25:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573741520; cv=none; d=google.com; s=arc-20160816; b=PJWRT/KhwszWuiukdcOXBKn9NLXspkPWb7cFmHmyeRRuhgli73s5j5zdWSuQP94rVQ CrWyFsc/UY6Pw3rdCQ397rjLUtgegAN71Zjm+YyZXViPd5ELC7vW3BRhYiNQ40/bSBIn reXKsH7j5AM6Xp94He+Vkl4sFjom29Cd2pZtzgOhf2aTDrSFTN2P5c/8veJcOw/WOJ+d J4kE+40bCYsmj49ScjspxACF2EOGfpI/xgfHomnIpsR4JiEbHaFUGINK8NfMdf9Icuat tWXtwjMfRP7A/QhjkavJnwH70a/ZRM4pGCyAQ4509C/L/CJhkIlDP85QUUKqZgR0PJ6M uAyg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YfeA14uuuPzU+N+/A63W2LLCo3IHXwSL/EjkK/pHBoA=; b=oqiwgSreLcKZzq7sisaRo4/42XhWhjTAjwnoplnIxJbb6Y0GYMt/2apFJ81MX9DNGX sYQX5s262zwTsRtCd/Jc/c5gP6/TfRvmXlIZeIKiWPa+EkVEbTIcST7LeeWlMGKFBjx4 UiBrW9QZIcW502+D5Uf8jTaZ8MsGQ4EOINlqQnd9SZRuzioWALExIEg19eMsuqz74wOu Ff17SGiQLBSV2MdgN/zn4iWAem4i/uenl61oFwuurx0Y7RolRzS1TfPQVSV9v5ecZpi/ oUZfcD7zklGEN57nZ/J4NWsDFOyOAFRTeEHZMC/tZzGhAVi7P0h9ro58GZ7tbo0bVlKx K8cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=PXwwk3aG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si4158313edl.128.2019.11.14.06.24.55; Thu, 14 Nov 2019 06:25:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=PXwwk3aG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbfKNOYM (ORCPT + 99 others); Thu, 14 Nov 2019 09:24:12 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:38588 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfKNOYL (ORCPT ); Thu, 14 Nov 2019 09:24:11 -0500 Received: by mail-qt1-f196.google.com with SMTP id p20so6946848qtq.5 for ; Thu, 14 Nov 2019 06:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=YfeA14uuuPzU+N+/A63W2LLCo3IHXwSL/EjkK/pHBoA=; b=PXwwk3aG8DnvtQt2WlwkDuxKtEq+rWhMjk6TRDPP6J7v2ijVF5ntwH71vv2+LPNGON FkVeLzwjcEl9zzEmJcuEcNJPI0Zl7WsDbJqqfHzJx7frAIJ4S82/egMXgAlt+KAcJs5S 0YpEBfP/fz89eoYIu0n6MBzOFLoIJNnjToi1iA49/WI0O6XoZQkkV4XX2reLekkoZGQK hEjn4cS4z2FfZfR+/wP3JKdL+Zb6WUpjELz+FQdgwysAQ0W+7Mvxhucp+WoKHgkywQuJ Gn94aN6yEE/wOFmjywIASyQrf+GqPnHZOHIa0aufOfzY3JC+/kDSQvxS1fIRd78B2N8u w67g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=YfeA14uuuPzU+N+/A63W2LLCo3IHXwSL/EjkK/pHBoA=; b=uOy3FMpZBc1FcpNwV/xGZbJUmBblZAa6h/XJmRF+HyKCcWOauHXGzbeDvwi8nKsYl6 JZETLGH7ErvaCo+VevF7Em7h4gy1Wsn8ifpoB3X8+yJ4D7P1gVaMN/eOZ+2vUU7U4cBM fUKgDGf4MIOgyqPi83sKDv3pMX2z7yKhoa54lC6pqvHo6FWzFoDgVaU/NI0TQpnBNK/q HMR8iZzDNrpOsazi4mv6JeiaarE5lHSTy71sjcprVXFhngDCDbj1Ym5n4kzYmb+iYy0o rdZjWQ0f7H8wSJSKExhgYHuECsnJvE5Bj5OIAAMaHuhPiKICpmCYEEDK8A8O4V0swQye GvWg== X-Gm-Message-State: APjAAAWHPfQY2K4EhdlFQn+voHn1CLwMSpAGhUmZmfE8bcsj3nUWONU3 jSgptJAixhdKnD6o1Zm5ZdUoMw== X-Received: by 2002:ac8:6757:: with SMTP id n23mr8291467qtp.345.1573741450490; Thu, 14 Nov 2019 06:24:10 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id s42sm3125140qtk.60.2019.11.14.06.24.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2019 06:24:09 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iVG2b-0000DC-9T; Thu, 14 Nov 2019 10:24:09 -0400 Date: Thu, 14 Nov 2019 10:24:09 -0400 From: Jason Gunthorpe To: Ralph Campbell Cc: Jerome Glisse , John Hubbard , Christoph Hellwig , Shuah Khan , linux-rdma@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v4 1/2] mm/hmm: make full use of walk_page_range() Message-ID: <20191114142409.GA785@ziepe.ca> References: <20191104222141.5173-1-rcampbell@nvidia.com> <20191104222141.5173-2-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191104222141.5173-2-rcampbell@nvidia.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 04, 2019 at 02:21:40PM -0800, Ralph Campbell wrote: > hmm_range_fault() calls find_vma() and walk_page_range() in a loop. > This is unnecessary duplication since walk_page_range() calls find_vma() > in a loop already. > Simplify hmm_range_fault() by defining a walk_test() callback function > to filter unhandled vmas. > This also fixes a bug where hmm_range_fault() was not checking > start >= vma->vm_start before checking vma->vm_flags so hmm_range_fault() > could return an error based on the wrong vma for the requested range. > It also fixes a bug when the vma has no read access and the caller did > not request a fault, there shouldn't be any error return code. > > Signed-off-by: Ralph Campbell > Cc: "Jérôme Glisse" > Cc: Jason Gunthorpe > Cc: Christoph Hellwig > Reviewed-by: Christoph Hellwig > --- > mm/hmm.c | 121 ++++++++++++++++++++++++++----------------------------- > 1 file changed, 58 insertions(+), 63 deletions(-) Applied to hmm.git with Christoph's hunk merged in Thanks, Jason