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 39911C433DB for ; Thu, 4 Feb 2021 00:11:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4FA364F65 for ; Thu, 4 Feb 2021 00:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4FA364F65 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F0AEE6B007D; Wed, 3 Feb 2021 19:11:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EBC476B007E; Wed, 3 Feb 2021 19:11:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD28F6B0080; Wed, 3 Feb 2021 19:11:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id C880C6B007D for ; Wed, 3 Feb 2021 19:11:04 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8285F181AEF1E for ; Thu, 4 Feb 2021 00:11:04 +0000 (UTC) X-FDA: 77778655248.08.skate75_150a6ce275d7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 651A31819E773 for ; Thu, 4 Feb 2021 00:11:04 +0000 (UTC) X-HE-Tag: skate75_150a6ce275d7 X-Filterd-Recvd-Size: 3581 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 00:11:03 +0000 (UTC) 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== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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