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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A482AC433F5 for ; Thu, 20 Jan 2022 04:27:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 304DA6B00CA; Wed, 19 Jan 2022 23:27:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 266E86B00CE; Wed, 19 Jan 2022 23:27:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1074F6B00D0; Wed, 19 Jan 2022 23:27:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id F39F96B00CA for ; Wed, 19 Jan 2022 23:27:54 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BE3AB181D303A for ; Thu, 20 Jan 2022 04:27:54 +0000 (UTC) X-FDA: 79049382468.29.4EB3A34 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id 961DDC0019 for ; Thu, 20 Jan 2022 04:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HHu2vcmAMjyZdp5l/HlaIQrYa0nqInGDI16V4wpDZxE=; b=kM8gwlss+dLkoAyh97n4QxGefg W3ayn98v6j7vqXuUf2HdhOVDe/4Pw1IEe9C6K7cj/vR4tvnJz4g2iWeHPGS5n4uSG4V07nzyZmDmD vlmxnrh51bIlgl62OXy81cYaqtCxb5w19Pa9y2T9y6FtI359xkpwv/yoT5fSHQRLWxAPdafyAjlOR vspfKJn7E3AyAcarQddnd5vKNG50ghktFogDYSAGeCdHJ4HqTYApThMkVc1XtHe2TUkQPFsLatAQy UxqxJ7woCITKqX3ZDz7gde9pPKSX8P6x+2tK9dZzRHaQvq+Wv2FdtHq2jxXBhLl8lXazb4ZY6De8X 8lpHIEIQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAP2t-00DKZK-Vb; Thu, 20 Jan 2022 04:27:36 +0000 Date: Thu, 20 Jan 2022 04:27:35 +0000 From: Matthew Wilcox To: Anshuman Khandual Cc: Yury Norov , Catalin Marinas , Will Deacon , Andrew Morton , Nicholas Piggin , Ding Tianhong , Alexey Klimov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Uladzislau Rezki Subject: Re: [PATCH] vmap(): don't allow invalid pages Message-ID: References: <20220118235244.540103-1-yury.norov@gmail.com> <5b62ed03-8da8-a94d-cc48-a8cac1eae1c9@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b62ed03-8da8-a94d-cc48-a8cac1eae1c9@arm.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 961DDC0019 X-Stat-Signature: yyt5s5x4jti9ftiwss57356oa8s4gq79 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kM8gwlss; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1642652873-711917 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 Thu, Jan 20, 2022 at 09:07:11AM +0530, Anshuman Khandual wrote: > > > On 1/19/22 10:52 PM, Yury Norov wrote: > >> Why should not this just scan over the entire user provided struct page > >> array and make sure that all pages there in are valid via above method, > >> but in vmap() itself before calling vmap_pages_range(). Because seems > >> like a single invalid page detected in vmap_pages_pte_range() will > >> anyways abort the entire vmap(). This will also enable us to drop the > >> existing NULL check above. > > > > I can do this, but why is it any better than the current approach? > > Because it will just return on the first instance where the valid page > check fails, saving us some CPU cycles and an incomplete mapping ? The valid page check is never intended to fail! If you're worried about the efficiency of doing this, you have seriously confused your priorities.