Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp947252imu; Fri, 7 Dec 2018 11:25:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/U/2aT5KvuDp2B6uQGMKLT/feoYJvILYn7o1zMyZsJMaqG3Bmg5vtf5M3MQqVXQFwbmj3QU X-Received: by 2002:a62:15c3:: with SMTP id 186mr3581526pfv.240.1544210757408; Fri, 07 Dec 2018 11:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544210757; cv=none; d=google.com; s=arc-20160816; b=Fn/ERF7uRtGYnqwaD6nJxsAtcx+137jo/CXs2ZVmEMdVTNgIMQPJLKJ4VFGJLKv+aQ mUrTP6zZB8p6Cr7Lc5Bq5atoTqARwmLTxcIC8qJhbkLdMUGdIp4I3ePBkSKET3/0dzPv 0f/+dvLyHcXUACI1onwkTz/wbe6c58s5mGBSqmWTUABqiNZiOnc6b3zLlLoz8NoPGkZw s8kYFlmtOoXNJyn9k96QEOlT77tgXH9Cjshd71klfDUBmbtKjrFdaz85mz7KaXOVGoWi uKv6A07d7mA9HhXF3lXMqn+JLwAIrmzf9GUQLF4MuB8Fwu8wz5XQg7Qv02vjm98r1l0Q eT6A== 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=9e2Wbzrvdn8hVT2tBhxVO0pp+kL6y3jwcx1ShpPzbP4=; b=BWlWMTptkpub8jSsnt2ctI7UtYtunsip8N2an73DvFSKW29IFPN1cNKfacxNVZ3mSR eUGUrvy3QDhfmZSeML+46v9lI/3Dh+7lCrPNS92gbobvG9nlPCd6zXcwE97XJNNstdb6 X+lUhsE6erZjnFRqF89yquvrrBqbhQolTP3wlql1QoZSVSFeigED1o2mB8yDVARxUQvy a7j80+wdDsORyfMgZtY3pXs2bc+CHL+gyP60mRGmoHnEczAI38fYc2RRC2STmk1UpFxw lbL8Vw2EySh0tGw4qvn4XPfT67UMSXB19vsKZ2xcrJYZhJjbxkeqE1JlxdGOv65Qg5nK ieew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZtJu/QZl"; 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 b12si3420038plx.159.2018.12.07.11.25.41; Fri, 07 Dec 2018 11:25:57 -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="ZtJu/QZl"; 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 S1726132AbeLGTYx (ORCPT + 99 others); Fri, 7 Dec 2018 14:24:53 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36037 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbeLGTYw (ORCPT ); Fri, 7 Dec 2018 14:24:52 -0500 Received: by mail-lj1-f196.google.com with SMTP id g11-v6so4505625ljk.3; Fri, 07 Dec 2018 11:24:50 -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=9e2Wbzrvdn8hVT2tBhxVO0pp+kL6y3jwcx1ShpPzbP4=; b=ZtJu/QZlyw3bilEm8S9OjKcAaFKDl8uywXIJPv9AXBWu7HUv1lNYCsoq8HAKttktyj ssHKnjWFm75vcL1BkZR6S/HWT1LqZybi7PHlkHL5Gvyu1SX4Uv1WAY8o1yT5uIo9VnZY vpOujufXZQzDptqRH68QItFYzJLEfbo/l0kXvHSgZyTb5d9yGcnluZTEBxPSiF6Wi/i4 D6LdrFTq9B6gKKkFc0wmIOsj7KboFS7ojG0/UP5B4tBFQo0EL188h8Sw6mlpJOBVvYHm xlWaL+qNVtOLh6aLFsUD9mklVCrvNKlMW5i3EgHUUglppRWtsj4/Ahh5Kyf5lDmFczee iefQ== 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=9e2Wbzrvdn8hVT2tBhxVO0pp+kL6y3jwcx1ShpPzbP4=; b=kJ72Wy4R5gGZMb2FARKL2KHZXNA2Ad2+BdgsezZtjkQlscUaAA6kn+u/H0NxjCQP4h 0Efp3DTuCvoH1c2rmfHtcgDBRuBqAgaF6Zjjy/Pk8moKrQUvDVdh1htkXa1oZ1PzETfX PQpj4zDNg80e6bBUVBDYiieTrrB23BDVM7/IJfZGg7yB6oLCQ9ZJpxQHZN+fPnqQV6rK mFerVGN7FmXpeU719Fl0Cykp9JIXrRbUb6doIaps7r4c0Yqpzq50OMVXl9VDRPPqyDl8 zp8SPY5Ku3ZZz/cjK6neou34VG9hIrRvBOmLOnHHQ5a2v8SItdmQ5E6141jUoLk9Km9q 2CKA== X-Gm-Message-State: AA+aEWb9banlCA8CB5patTNbo/JJM7ah6vY1PzgVDJsdlbOdT/zTdIn8 oc66UBVxF2oIdqnxAnbFmfhK+QXGovaZGXvGPGE= X-Received: by 2002:a2e:9181:: with SMTP id f1-v6mr2058524ljg.64.1544210689938; Fri, 07 Dec 2018 11:24:49 -0800 (PST) MIME-Version: 1.0 References: <20181206183945.GA20932@jordon-HP-15-Notebook-PC> <53bbc095-c9f5-5d6a-6e50-6e060d17eb68@arm.com> <20181207171116.GA29923@bombadil.infradead.org> In-Reply-To: <20181207171116.GA29923@bombadil.infradead.org> From: Souptick Joarder Date: Sat, 8 Dec 2018 00:58:26 +0530 Message-ID: Subject: Re: [PATCH v3 1/9] mm: Introduce new vm_insert_range API To: Matthew Wilcox Cc: robin.murphy@arm.com, 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 , 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, Dec 7, 2018 at 10:41 PM Matthew Wilcox wrote: > > On Fri, Dec 07, 2018 at 03:34:56PM +0000, Robin Murphy wrote: > > > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr, > > > + struct page **pages, unsigned long page_count) > > > +{ > > > + unsigned long uaddr = addr; > > > + int ret = 0, i; > > > > Some of the sites being replaced were effectively ensuring that vma and > > pages were mutually compatible as an initial condition - would it be worth > > adding something here for robustness, e.g.: > > > > + if (page_count != vma_pages(vma)) > > + return -ENXIO; > > I think we want to allow this to be used to populate part of a VMA. > So perhaps: > > if (page_count > vma_pages(vma)) > return -ENXIO; Ok, This can be added. I think Patch [2/9] is the only leftover place where this check could be removed.