Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6856793ybi; Wed, 31 Jul 2019 23:09:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTwCblTBbSPJxKgfMbGk4fg4H2u4xzTuJX7aJvpB+MhR266N0YmaeDhRW4qzQ5ZPQ3B+p+ X-Received: by 2002:a17:90a:b115:: with SMTP id z21mr6648437pjq.64.1564639753940; Wed, 31 Jul 2019 23:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564639753; cv=none; d=google.com; s=arc-20160816; b=gIO+8DCOP8mWZ3RiYXsno+LKvGkP1lFkKLgz9FJ7t40+N2nhmdtsKxYeS//zHZzraw Bf7n1a3mdtlqB/W3u/0LNKAP4F64tBVusVw5tl3Bd0xQoU5ypHCAIh0YXHENy5rEGdwD DGA9sp8GLL8xQJSI0nDbP2nbwdbT+gNMkZjThn6CvWpvsE9AuuhIL9409okNHLXASrIE tVtzO7ruGmyU+O71HqArHTYwrt6V5FZlUf7kuof35pGc2et3Hu/NZOvSF0BnPCu3VU4S HWMxYR1pp3C2psEjHeaMe0OMaKnD6nJXXiiNYfG4oGrZB1aYMJ197x+/jhuyYjiyCVo8 6qcA== 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=VQcYPtHxzMzUXVDsuQUJCCEVEdVeXdGSm3Qi6JZs/dA=; b=naGjeydVKtpgPDYSUOack+52tXYeD0pv1a39uhorlZYxCUKUubHqJK+GOcfBOAz+6P 1nChOVY60hy1PXSlSyL/gTjGCauHVff1Ye/LCWifD5tqwhYZAshj9+Kw3Xprrga1QPYs bMROJYv2i0Mpj861sqOVdciIXz97rjHWySv/IZrm04DrrvBGhaZvZaPXBkUBQrBoYNHT H3Jjq/gd4rwqF4vRLf6vTuTwkflQKG92bwI718YPvbBPv5eFvQRIt6TgmC9iPjisjn0I HtvMwxwTv1Ww4b6mmhXg+YP0v5u+sXBD7cTC8lbSwupkWeD9q/sOW0Gh28jCQai8MJmv lH0w== ARC-Authentication-Results: i=1; mx.google.com; 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 t19si31620827plo.376.2019.07.31.23.08.58; Wed, 31 Jul 2019 23:09:13 -0700 (PDT) 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; 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 S1728843AbfHAGIC (ORCPT + 99 others); Thu, 1 Aug 2019 02:08:02 -0400 Received: from verein.lst.de ([213.95.11.211]:40460 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbfHAGIC (ORCPT ); Thu, 1 Aug 2019 02:08:02 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 9C9C468B05; Thu, 1 Aug 2019 08:07:55 +0200 (CEST) Date: Thu, 1 Aug 2019 08:07:55 +0200 From: Christoph Hellwig To: john.hubbard@gmail.com Cc: Andrew Morton , Al Viro , Christian Benvenuti , Christoph Hellwig , Dan Williams , "Darrick J . Wong" , Dave Chinner , Ira Weiny , Jan Kara , Jason Gunthorpe , Jens Axboe , Jerome Glisse , "Kirill A . Shutemov" , Matthew Wilcox , Michal Hocko , Mike Marciniszyn , Mike Rapoport , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, LKML , John Hubbard , Christoph Hellwig Subject: Re: [PATCH v4 1/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock() Message-ID: <20190801060755.GA14893@lst.de> References: <20190730205705.9018-1-jhubbard@nvidia.com> <20190730205705.9018-2-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190730205705.9018-2-jhubbard@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 Tue, Jul 30, 2019 at 01:57:03PM -0700, john.hubbard@gmail.com wrote: > @@ -40,10 +40,7 @@ > static void __qib_release_user_pages(struct page **p, size_t num_pages, > int dirty) > { > - if (dirty) > - put_user_pages_dirty_lock(p, num_pages); > - else > - put_user_pages(p, num_pages); > + put_user_pages_dirty_lock(p, num_pages, dirty); > } __qib_release_user_pages should be removed now as a direct call to put_user_pages_dirty_lock is a lot more clear. > index 0b0237d41613..62e6ffa9ad78 100644 > --- a/drivers/infiniband/hw/usnic/usnic_uiom.c > +++ b/drivers/infiniband/hw/usnic/usnic_uiom.c > @@ -75,10 +75,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty) > for_each_sg(chunk->page_list, sg, chunk->nents, i) { > page = sg_page(sg); > pa = sg_phys(sg); > - if (dirty) > - put_user_pages_dirty_lock(&page, 1); > - else > - put_user_page(page); > + put_user_pages_dirty_lock(&page, 1, dirty); > usnic_dbg("pa: %pa\n", &pa); There is a pre-existing bug here, as this needs to use the sg_page iterator. Probably worth throwing in a fix into your series while you are at it. > @@ -63,15 +63,7 @@ struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index) > static void siw_free_plist(struct siw_page_chunk *chunk, int num_pages, > bool dirty) > { > - struct page **p = chunk->plist; > - > - while (num_pages--) { > - if (!PageDirty(*p) && dirty) > - put_user_pages_dirty_lock(p, 1); > - else > - put_user_page(*p); > - p++; > - } > + put_user_pages_dirty_lock(chunk->plist, num_pages, dirty); siw_free_plist should just go away now. Otherwise this looks good to me.