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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 A8F68C3B18D for ; Thu, 13 Feb 2020 21:38:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6FC3B206B6 for ; Thu, 13 Feb 2020 21:38:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="cFIjwFlk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FC3B206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F03F06B05B0; Thu, 13 Feb 2020 16:38:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EB43B6B05B1; Thu, 13 Feb 2020 16:38:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7B346B05B2; Thu, 13 Feb 2020 16:38:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id BAFD96B05B0 for ; Thu, 13 Feb 2020 16:38:01 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7245D824556B for ; Thu, 13 Feb 2020 21:38:01 +0000 (UTC) X-FDA: 76486416762.15.ship63_80316e8569e06 X-HE-Tag: ship63_80316e8569e06 X-Filterd-Recvd-Size: 4871 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 21:38:00 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id x14so8306052ljd.13 for ; Thu, 13 Feb 2020 13:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jtS4rjKch/eIxYuRE1rBd1Np3fh95EMJHZPtozx1IdU=; b=cFIjwFlka8Q6k5k0uwiVOYQh3KBGZAx1jTW+glsWmbGPwW49m06Ggcglnis/tiHHay ZSE+vfV0yXAAXW0sTdr2mfTP0lHIqZJAWrU2TNWwpoj1rKjxwn/vmL5G7GDwWRxe9gI5 OFGRlR97WSSIJ71X/s74bTCKEX95FOy4zawho= 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=jtS4rjKch/eIxYuRE1rBd1Np3fh95EMJHZPtozx1IdU=; b=B+DYCc1+UCcfLTRU7omLsVFRKmEEbUFfLW197AwtoGGVKSI5VGRPkojjVI+ANd0FX6 QsZ7JNhG5riewXztlBwXfktwnXqggBV945NMnEpmQLyENkjhE48c+W/LJLmpS7WK8KBx oSIxnfDva35fXe1G4ZzeDO2qX4tL8bqPPH6dxCdA/t5ZpmuHOGsGSdQXQS+b9YKP11Td MxOWh+ujgbb1L9AAOwcW8aelfYK3w30CfIvHwQMw9bAn/UiRJODjHknda8WH7VwlGkTB btOkiKMf6XIpjCgYW9FQ0WtxDND2AKWpuCLzBCDlYNg4ZXC0X5rYCP1UUsiRGRfaAivv 3Dbg== X-Gm-Message-State: APjAAAXfOwA7i22QyU//qn5sNj55b/60YxIr/fqW74gL65GiZscV81ME RsSQA0bdNyND7QJ46xfyMuslL3wHShc= X-Google-Smtp-Source: APXvYqzk7d0mTwDATSFpy53/d9wxYg+vQrALULrKzOxTZQNWjBXnLiL7AA25nPEm5ux7Fjcz8Ix+HQ== X-Received: by 2002:a2e:b4af:: with SMTP id q15mr11775602ljm.43.1581629878250; Thu, 13 Feb 2020 13:37:58 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id f16sm692277lfm.40.2020.02.13.13.37.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Feb 2020 13:37:57 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id o15so8337249ljg.6 for ; Thu, 13 Feb 2020 13:37:56 -0800 (PST) X-Received: by 2002:a2e:88c5:: with SMTP id a5mr12479474ljk.201.1581629876398; Thu, 13 Feb 2020 13:37:56 -0800 (PST) MIME-Version: 1.0 References: <20200128025958.43490-1-arjunroy.kdev@gmail.com> <20200128025958.43490-2-arjunroy.kdev@gmail.com> <20200212184101.b8551710bd19c8216d62290d@linux-foundation.org> In-Reply-To: <20200212184101.b8551710bd19c8216d62290d@linux-foundation.org> From: Linus Torvalds Date: Thu, 13 Feb 2020 13:37:40 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH resend mm,net-next 2/3] mm: Add vm_insert_pages(). To: Andrew Morton Cc: Arjun Roy , David Miller , Netdev , Linux-MM , arjunroy@google.com, Eric Dumazet , Soheil Hassas Yeganeh Content-Type: text/plain; charset="UTF-8" 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 Wed, Feb 12, 2020 at 6:41 PM Andrew Morton wrote: > > Also, vm_insert_page() does > > if (!page_count(page)) > return -EINVAL; > > and this was not carried over into vm_insert_pages(). How come? Sounds like that was just a mistake. > I don't know what that test does - it was added by Linus in the > original commit a145dd411eb28c83. It's only been 15 years so I'm sure > he remembers ;) Oh, sure. No, I have absolutely no memory of the details, but I think the commit message is actually the big hint: the difference between vm_insert_page() and some of the more random "insert any pdf" cases we have is exactly that: The page you insert needs to be a nice clean kernel allocation, so you can't insert arbitrary page mappings with this, but that's not what people want. thing. The comment above it also kind of hints at it. We *historically* had interfaces to insert random reserved pages (for IO mappings, but also the zero page etc), but the whole point of that vm_insert_page() is that it's now an interface for drivers to insert the pages they maintain into the page tables. But that also means that we very much didn't allow just random pages accessed by doing pfn lookups (that might not be in use at all). Is "page_count()" a great test? No. But it's at least _a_ test of that. No reserved pages or other magic need apply. Linus