Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3023489imj; Mon, 11 Feb 2019 12:28:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IbyGLesGBVbbExDXLwOb2zF8maHWFslk5rTj/5WN61xHdQKDtPtUotPCSWAmxM3ToyYhenb X-Received: by 2002:a63:1061:: with SMTP id 33mr80511pgq.108.1549916928932; Mon, 11 Feb 2019 12:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549916928; cv=none; d=google.com; s=arc-20160816; b=IOib6oCGCL4IwO2EX+GfprS0hMGTDdD2+y22sGdYqReVBwYNgKTgmunJyDvIisXEOm 2kCrYUnIqhtaBztU7GWJ0OMs8LsDkzuH5WgsmyiNib1TmBZoW4BXRsrs7HY8sYY1vTPi CrHLGmbp8XPGYdpsA35TU6MhKDKkW7zAheUBb38V+uAAPlMwHW2UYkoctFaVNptXGrmt Dn3gUx3IyBL8QlNz5OKay769evJ0GVEayYaizoB8hECzOPSPSMM3fhLc+R7XToin2XNH eseB2F2zOHRbXI9FrhRCApPY0hN1OYMMsvfG889dMTB0esOV7PLyWqhbDzjydtqIA+GR I7rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UhMN5gACQr1+W4A8Ag5wPDh62RaNjK/ZgHm434PrC78=; b=aeLzucvxAytusfXNrIC8RFmpJ2gITmqL+0+8yYrobAOkTVHpBBOgP2afBhWtt/BoSv zKEHxGkHZ0Q4B42d6sVKqepbXUrOKogK8syauqMNhw3EXCoY/qcBajHdMV/cDXPGDLQW uS4sD8GpiS/MLGJiIpgNMX/XzsLUWy+sT5gaaAbw8MCwJJdEtgsLJ6nw9sl10+/TQNy0 Uuc0dmHAxCiY0MWRBEay9m+h3p9ppdBnBpQ+Q0u7WpzOrIk8nHPhdLGO6PjdKU08vGOm NZjRPvsfKH0xKBIDfuFIfeDpDrYEIrF686svlrAjlwwq+OQw5CCx3AcXhHqam372soyQ zZlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dycem5Iy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si11052964plp.114.2019.02.11.12.28.32; Mon, 11 Feb 2019 12:28:48 -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=@gmail.com header.s=20161025 header.b=Dycem5Iy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728472AbfBKRCJ (ORCPT + 99 others); Mon, 11 Feb 2019 12:02:09 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44091 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727117AbfBKRCI (ORCPT ); Mon, 11 Feb 2019 12:02:08 -0500 Received: by mail-lf1-f66.google.com with SMTP id g2so3041110lfh.11; Mon, 11 Feb 2019 09:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UhMN5gACQr1+W4A8Ag5wPDh62RaNjK/ZgHm434PrC78=; b=Dycem5Iy15XhBFQsCdrlyR70cVYi8iEHdjbiM68ElBqd2AuRvAsNQVBPszRVGhzOes 4ghWIEDaZJqjwIvPAoy9X2DP7JqHWi80tnUpOlPWlpZ1uM1s61kbY33b7oQI39GLLDGn E61Ey9sXAEhgkUTxWs3YjJn/cr2UtlFvIsMQptsivCA4qcu2lBVw1mBwHXi14ZhLqfZT llfzt7bn5yuGTsb/KDKH+rY6A+TOjuCAl9E0Djzyw3HMlvO3y65at592q5FsX1KdRYDL KORq40gRwIB8Akjia616vJ//3AM1qSrbGnqfQtj9Zf7Jn60umhLieOoHQwDpAo7mMfoP LsLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UhMN5gACQr1+W4A8Ag5wPDh62RaNjK/ZgHm434PrC78=; b=otaoBI5wxF8HAarKjPoudnYKco5KDIpo5O2aUlXzN+iZLrU4sdA+csJAauoTSM9o49 HcdTZtn828YhwMPETdJv1xaTPZ5Q9Dov8JXelru6CbZHSB1JFocwXBpUgPiAZRfLwp8g 2gMtoA376bANKqV4FqD5SKpYIVkwzejAbeWVicRkGZfMdMoxCbl6LN7ucLKUVlYKbvC9 GraBu1fnJ+bCXPm9drh5649hn8yHepe6QqlpEq9gu+r5FnGgCLNGzHvwRnQThRL5xV8H D9s8MEcFj1Ezjo8QW7F4deRZGA6xHBwdO30r68k+lnQ+xgsW2Iq6Z0T5HRxb9YLJDeMz 55xg== X-Gm-Message-State: AHQUAuaGlpia1gFDZ0NEgopHekh93ghGJjp0dySHtm9bZ17PcqXFHCls rPDrkbsDz0YH3Bzb8G3LBE77eqwNrSWLUOTxrRw= X-Received: by 2002:ac2:4318:: with SMTP id l24mr631387lfh.75.1549904525499; Mon, 11 Feb 2019 09:02:05 -0800 (PST) MIME-Version: 1.0 References: <20190131030812.GA2174@jordon-HP-15-Notebook-PC> <20190131083842.GE28876@rapoport-lnx> <20190207164739.GX21860@bombadil.infradead.org> In-Reply-To: From: Souptick Joarder Date: Mon, 11 Feb 2019 22:36:15 +0530 Message-ID: Subject: Re: [PATCHv2 1/9] mm: Introduce new vm_insert_range and vm_insert_range_buggy API To: Matthew Wilcox Cc: Mike Rapoport , Andrew Morton , Michal Hocko , "Kirill A. Shutemov" , vbabka@suse.cz, Rik van Riel , Stephen Rothwell , rppt@linux.vnet.ibm.com, Peter Zijlstra , Russell King - ARM Linux , robin.murphy@arm.com, iamjoonsoo.kim@lge.com, treding@nvidia.com, Kees Cook , Marek Szyprowski , stefanr@s5r6.in-berlin.de, hjc@rock-chips.com, Heiko Stuebner , airlied@linux.ie, oleksandr_andrushchenko@epam.com, joro@8bytes.org, pawel@osciak.com, Kyungmin Park , mchehab@kernel.org, Boris Ostrovsky , Juergen Gross , linux-kernel@vger.kernel.org, Linux-MM , linux-arm-kernel@lists.infradead.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, xen-devel@lists.xen.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 8, 2019 at 10:52 AM Souptick Joarder wrote: > > On Thu, Feb 7, 2019 at 10:17 PM Matthew Wilcox wrote: > > > > On Thu, Feb 07, 2019 at 09:19:47PM +0530, Souptick Joarder wrote: > > > Just thought to take opinion for documentation before placing it in v3. > > > Does it looks fine ? > > > > > > +/** > > > + * __vm_insert_range - insert range of kernel pages into user vma > > > + * @vma: user vma to map to > > > + * @pages: pointer to array of source kernel pages > > > + * @num: number of pages in page array > > > + * @offset: user's requested vm_pgoff > > > + * > > > + * This allow drivers to insert range of kernel pages into a user vma. > > > + * > > > + * Return: 0 on success and error code otherwise. > > > + */ > > > +static int __vm_insert_range(struct vm_area_struct *vma, struct page **pages, > > > + unsigned long num, unsigned long offset) > > > > For static functions, I prefer to leave off the second '*', ie make it > > formatted like a docbook comment, but not be processed like a docbook > > comment. That avoids cluttering the html with descriptions of internal > > functions that people can't actually call. > > > > > +/** > > > + * vm_insert_range - insert range of kernel pages starts with non zero offset > > > + * @vma: user vma to map to > > > + * @pages: pointer to array of source kernel pages > > > + * @num: number of pages in page array > > > + * > > > + * Maps an object consisting of `num' `pages', catering for the user's > > > > Rather than using `num', you should use @num. > > > > > + * requested vm_pgoff > > > + * > > > + * If we fail to insert any page into the vma, the function will return > > > + * immediately leaving any previously inserted pages present. Callers > > > + * from the mmap handler may immediately return the error as their caller > > > + * will destroy the vma, removing any successfully inserted pages. Other > > > + * callers should make their own arrangements for calling unmap_region(). > > > + * > > > + * Context: Process context. Called by mmap handlers. > > > + * Return: 0 on success and error code otherwise. > > > + */ > > > +int vm_insert_range(struct vm_area_struct *vma, struct page **pages, > > > + unsigned long num) > > > > > > > > > +/** > > > + * vm_insert_range_buggy - insert range of kernel pages starts with zero offset > > > + * @vma: user vma to map to > > > + * @pages: pointer to array of source kernel pages > > > + * @num: number of pages in page array > > > + * > > > + * Similar to vm_insert_range(), except that it explicitly sets @vm_pgoff to > > > > But vm_pgoff isn't a parameter, so it's misleading to format it as such. > > > > > + * 0. This function is intended for the drivers that did not consider > > > + * @vm_pgoff. > > > + * > > > + * Context: Process context. Called by mmap handlers. > > > + * Return: 0 on success and error code otherwise. > > > + */ > > > +int vm_insert_range_buggy(struct vm_area_struct *vma, struct page **pages, > > > + unsigned long num) > > > > I don't think we should call it 'buggy'. 'zero' would make more sense > > as a suffix. > > suffix can be *zero or zero_offset* whichever suits better. > > > > > Given how this interface has evolved, I'm no longer sure than > > 'vm_insert_range' makes sense as the name for it. Is it perhaps > > 'vm_map_object' or 'vm_map_pages'? > > > > I prefer vm_map_pages. Considering it, both the interface name can be changed > to *vm_insert_range -> vm_map_pages* and *vm_insert_range_buggy -> > vm_map_pages_{zero/zero_offset}. > > As this is only change in interface name and rest of code remain same > shall I post it in v3 ( with additional change log mentioned about interface > name changed) ? > > or, > > It will be a new patch series ( with carry forward all the Reviewed-by > / Tested-by on > vm_insert_range/ vm_insert_range_buggy ) ? Any suggestion on this minor query ?