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 X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5670DC433DB for ; Thu, 4 Feb 2021 00:12:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2919664F65 for ; Thu, 4 Feb 2021 00:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233918AbhBDALr (ORCPT ); Wed, 3 Feb 2021 19:11:47 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:7259 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233893AbhBDALp (ORCPT ); Wed, 3 Feb 2021 19:11:45 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 03 Feb 2021 16:11:02 -0800 Received: from [10.2.50.90] (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 4 Feb 2021 00:11:01 +0000 Subject: Re: [PATCH 3/4] mm/gup: add a range variant of unpin_user_pages_dirty_lock() To: Joao Martins , CC: , , Andrew Morton , Jason Gunthorpe , Doug Ledford , Matthew Wilcox References: <20210203220025.8568-1-joao.m.martins@oracle.com> <20210203220025.8568-4-joao.m.martins@oracle.com> From: John Hubbard Message-ID: Date: Wed, 3 Feb 2021 16:11:01 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Thunderbird/85.0 MIME-Version: 1.0 In-Reply-To: <20210203220025.8568-4-joao.m.martins@oracle.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612397462; bh=DNBYb3L4KiWY74m9biXZbcqQW9XI3txRrkSsbMu9ghQ=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=B6AYUoKu4Trv11icR0SWcDtM6e5GqJOX86hQXkoRhyCMGr0TxiOHewbCIY3u9I4J8 3bLYBIFWlJQlDEPE7Fd1RgVOpQazabZtXhE4IjK2IzMMMWvLUb3UXCk0RD0XvK0irU W4fV5kmKugwxesipwjlGyBDrPU7oWCXdyKzemc+p4oD1toFab8hMVJ2v8u/G4gstRu B5OBAVwu2qOKMQ3U4pr2FTjNmxJhcs8ZsnrsVXythen7nyQm72Zgr070er4OuqO7Rv nT2s8xyrqAtGnEvFG/o5prm6eaUUPZaXUHTRdT1jcZzFiES0oZX02Ub0Sj+tDGMPtk C+pjeHd8ry65Q== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/3/21 2:00 PM, Joao Martins wrote: ... > +void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages, > + bool make_dirty) > +{ > + unsigned long index; > + struct page *head; > + unsigned int ntails; > + > + for_each_compound_range(index, &page, npages, head, ntails) { > + if (make_dirty && !PageDirty(head)) > + set_page_dirty_lock(head); > + put_compound_head(head, ntails, FOLL_PIN); > + } > +} > +EXPORT_SYMBOL(unpin_user_page_range_dirty_lock); > + Also, looking at this again while trying to verify the sg diffs in patch #4, I noticed that the name is tricky. Usually a "range" would not have a single struct page* as the argument. So in this case, perhaps a comment above the function would help, something approximately like this: /* * The "range" in the function name refers to the fact that the page may be a * compound page. If so, then that compound page will be treated as one or more * ranges of contiguous tail pages. */ ...I guess. Or maybe the name is just wrong (a comment block explaining a name is always a bad sign). Perhaps we should rename it to something like: unpin_user_compound_page_dirty_lock() ? thanks, -- John Hubbard NVIDIA