Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp334437ybt; Fri, 26 Jun 2020 00:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPHkAiyqFf8BAAi1/wcRV8PZ2vs0aeeosXb/5fD0GKWZu3H4d7Ctv4LMjizDKBNa/Nm/cv X-Received: by 2002:a50:aacc:: with SMTP id r12mr1910807edc.219.1593155418253; Fri, 26 Jun 2020 00:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593155418; cv=none; d=google.com; s=arc-20160816; b=JqtZSpESq8kd6CMcVGp+etJ0LIIq73BFRPi1gaKSgXIDNOY05ykYLfy3fyHlos01QP V1czD3Z3H4GKDUTAPrzM81nXW5kSQREkZCZNZfBC9oUdYOsNQghncexjvRaWc1yv5Ynd rh6g6hFeBd4rHFUQTR27pVe/B//fVsl66y74cXS/eSafi5LG88jEdnjte8JEKhWOnByG JyTiGNjFXkbHQxFv+Zg/kUM1+TSW9qB/N3RX6L3/zOoRVbqkfMfAG00H62Xf17ErRCqX xIDTgJqWDa42yhgHYA2eM4q3+5I1i6K/79moUPMduZMWHNy1mBwz9047VETMmvr4rk1P 0rhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Q41CWEP5r3Ufe0JNWhziz/qb4o51XvJxncTjiFALTd8=; b=TzHRDy61PBVj1Ysca+09nZ8LBhXIFGnIkaNJpYIGFMp7zQw1mC6PGfTJOOhbLu80XL lqc+XcdyJ8k4UVYSOWSkfEytQ+WctRdfrSpW51+cu/NsDurKLCICi+DZc1qS57kCx31T QE4whPTv3RwyVvQ6pM8rgY0lUlklIIPloHv9PWZYp3U2Y7GqFTnWAzrBlXdT3pcrFJZp EXkGS2GXxEWcXlf2pqhX5lUB7MGmohmB3Xjsr1q5f5PZQ8c3FmcV6a5ChaMNPv2KYVsb QdARVqGJ4iaFBJB70iwjSntXxMG0srmFn7AXqYSFIDeRrvoJKpQXdgJUexdnIZgDP1+C +GBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=KztnXTTd; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si16253007ejj.420.2020.06.26.00.09.55; Fri, 26 Jun 2020 00:10:18 -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=@nvidia.com header.s=n1 header.b=KztnXTTd; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728544AbgFZGya (ORCPT + 99 others); Fri, 26 Jun 2020 02:54:30 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:12299 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728541AbgFZGya (ORCPT ); Fri, 26 Jun 2020 02:54:30 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 25 Jun 2020 23:52:55 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 25 Jun 2020 23:54:29 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 25 Jun 2020 23:54:29 -0700 Received: from [10.2.63.78] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Jun 2020 06:54:29 +0000 Subject: Re: [PATCH 2/2] xen/privcmd: Convert get_user_pages*() to pin_user_pages*() To: Souptick Joarder CC: Boris Ostrovsky , Juergen Gross , , , , Paul Durrant References: <1593054160-12628-1-git-send-email-jrdr.linux@gmail.com> <1593054160-12628-2-git-send-email-jrdr.linux@gmail.com> <59afe2fe-3718-85aa-f3b5-83ca0b9df577@nvidia.com> From: John Hubbard Message-ID: Date: Thu, 25 Jun 2020 23:54:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1593154375; bh=Q41CWEP5r3Ufe0JNWhziz/qb4o51XvJxncTjiFALTd8=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=KztnXTTdUvCLh7PVjhgdEdJjQLzOZ+aiFMqOIGgtqGoF0ODBvP087ugRo3NmzGeBU spIKPTrXPydpzoSH1PEByxRFPLmch6g1j9Ts6UuzwLBNdRsplAxU00Upc7Fn73AN1A jAyupSo+0x5EY6DMJiyuNm2cl96pczadN10iObrRoix9yShwNmNk3XQt6Iv/81P+LG mk3cyuVI9pY9kgOqNBpI6MQ+1VJ6WXJc//TcPdFrEQzi1gNw4aT0k/nJFwrpuKvCVH 727IJiaCE++NmKS8Na8++JuQCfdG9BKYQb2yCQ5DMKW+xnzb9QSzraquFoe866bI1i xyboQkZZz52hA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-25 22:26, Souptick Joarder wrote: > On Thu, Jun 25, 2020 at 11:19 AM John Hubbard wrote: >> On 2020-06-24 20:02, Souptick Joarder wrote: ... >>> @@ -612,13 +612,7 @@ static int lock_pages( >>> >>> static void unlock_pages(struct page *pages[], unsigned int nr_pages) >>> { >>> - unsigned int i; >>> - >>> - for (i = 0; i < nr_pages; i++) { >>> - if (!PageDirty(page)) >>> - set_page_dirty_lock(page); >>> - put_page(pages[i]); >>> - } >>> + unpin_user_pages_dirty_lock(pages, nr_pages, 1); >> >> "true", not "1", is the correct way to call that function. > > Ok. > >> >> Also, this approach changes the behavior slightly, but I think it's Correction, I forgot that I put that same if(!PageDirty(page)) check into unpin_user_pages_dirty_lock(). So it doesn't change behavior. That's good. >> reasonable to just set_page_dirty_lock() on the whole range--hard to >> see much benefit in checking PageDirty first. > > unpin_user_pages_dirty_lock() internally will do the same check after > patch [2/2] > So I thought to keep old and new code in sync. Shall we avoid this check ? > Just leave it as you have it, but of course use "true" instead of 1, please. thanks, -- John Hubbard NVIDIA