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 E8276C7EE26 for ; Fri, 19 May 2023 15:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D23C900006; Fri, 19 May 2023 11:10:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A94B900003; Fri, 19 May 2023 11:10:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 470B5900006; Fri, 19 May 2023 11:10:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 39019900003 for ; Fri, 19 May 2023 11:10:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 16DAC120A95 for ; Fri, 19 May 2023 15:10:16 +0000 (UTC) X-FDA: 80807340432.29.A6D101D Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by imf08.hostedemail.com (Postfix) with ESMTP id 47BD3160018 for ; Fri, 19 May 2023 15:09:58 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=arndb.de header.s=fm3 header.b=K78d4ZcA; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ftIfzBI9; dmarc=none; spf=pass (imf08.hostedemail.com: domain of arnd@arndb.de designates 66.111.4.28 as permitted sender) smtp.mailfrom=arnd@arndb.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684508998; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HdAFOpP4Mmpj8sP8nf+XQRyuNt5e1ngGbSBEuPLR87Y=; b=EbKbyu/rWn/pShu4EZgVriEvrctxbkWlMxBKTqfvpwE46/UC+zsA43OnnMPOWrwtPrritb 42pRIG7YDORNBauaiHsYlsPcL0doClbEnsNrIQj2UFpdDKyC+WcMQBSm1s1JGSEKrkF94m j4adPf136Em8nBafx8gOqJFrQ78ehDs= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=arndb.de header.s=fm3 header.b=K78d4ZcA; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=ftIfzBI9; dmarc=none; spf=pass (imf08.hostedemail.com: domain of arnd@arndb.de designates 66.111.4.28 as permitted sender) smtp.mailfrom=arnd@arndb.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684508998; a=rsa-sha256; cv=none; b=DcnW9GLhJz2y/jVtdnRAw8ZY32WvuBp0dG6fe1gQq5B7HoB+GSsvaNg28nAMTX4rMAZvNq 815pZ+OY6cghPBaLWI1/oMMOLOzcLe1z8QVOIs/OY6mL0DHPGzbiB5k3SN7shw/N7wcylk gNvYwyxQR4k7MyaFY+uAqJDR3/75nfo= Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 78D6E5C01E4; Fri, 19 May 2023 11:09:57 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Fri, 19 May 2023 11:09:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1684508997; x=1684595397; bh=Hd AFOpP4Mmpj8sP8nf+XQRyuNt5e1ngGbSBEuPLR87Y=; b=K78d4ZcA+QFwcBlStc cQQ4iYXDop4aIpgBuKqwKvLt25kPy3BtCpKOgNfoIFMw7PGm8cZ9BjQmPuHlVBt5 MUihYz2EDPttZvPEQKzYhWoFzJ4osztmjl6rOwuW4eXQuP/YMYZ2XCZNSxU2iyaU Sxil6LPHtoVjM+CoOmHmqU6k++qMY10ZHJK4jwT2iSt9Hupfr+wuAIEuhsycZwFV 8EcUoeeZ7INOot/zOejk2HazHxI7B+Lop4oIoyVU0isx1e+bhUbHj1yFQlYZPacW XuuqUeaAEoqNaydIRHBXL0Y2QO8UfG7SJ1Hva14MAtfxfdJ7vsrurQFbhz5OG7Y7 XIvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684508997; x=1684595397; bh=HdAFOpP4Mmpj8 sP8nf+XQRyuNt5e1ngGbSBEuPLR87Y=; b=ftIfzBI9DALcM4R1kBB4Wvk+fT0eA jH509uhYkuKVC234j+xnAggzTeQXyOFTKSYxQBSlHbEKI7HrZECONql3zCZ/nEzK OO52dzJKuab34buXQH2Kq1smsfapoWBdYToodvYgdZig7e0v3/2G5isnIvmoXXwy 802paETXLUhfJcfK+kgpNIQK4ZJDJulv+UxTjapN+L+jHfYTHOVXskB+dE1/eOF9 lZdtNDgfCdNvuFOF11obm4BnzWPRjUHTCS5wvp+RBTgjBA8yy6tC2a2GCdTHoYuo OIe8U2MCwqLwM2JigAoGdxDvb0BWamTTzjJ7d09CsN8bCcgIyYjVXyvgQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeihedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 39E83B6008D; Fri, 19 May 2023 11:09:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-431-g1d6a3ebb56-fm-20230511.001-g1d6a3ebb Mime-Version: 1.0 Message-Id: <7d7ddc48-5985-4678-9f87-6e9b574a24d9@app.fastmail.com> In-Reply-To: <5b071f65-7f87-4a7b-a76a-f4a1c1568ae7@lucifer.local> References: <20230519093953.10972-1-arnd@kernel.org> <5b071f65-7f87-4a7b-a76a-f4a1c1568ae7@lucifer.local> Date: Fri, 19 May 2023 17:09:35 +0200 From: "Arnd Bergmann" To: "Lorenzo Stoakes" , "Arnd Bergmann" Cc: "Andrew Morton" , "Catalin Marinas" , "Will Deacon" , "Peter Zijlstra" , "Ingo Molnar" , "Arnaldo Carvalho de Melo" , "Mark Rutland" , "Alexander Shishkin" , "Jiri Olsa" , "Namhyung Kim" , "Ian Rogers" , "Adrian Hunter" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] [suggestion] mm/gup: avoid IS_ERR_OR_NULL Content-Type: text/plain X-Rspamd-Queue-Id: 47BD3160018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: srdgq3fxue5c65pmxt1onzqhetbqzaot X-HE-Tag: 1684508998-354371 X-HE-Meta: U2FsdGVkX18pU09JmFfhL98V596R2U3AM92JxDJfGa2AlmY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PIDJTOx9KAy/lSJkZR8p407Odvv3RtUO7uqJJQTYmDQ== 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 Fri, May 19, 2023, at 16:51, Lorenzo Stoakes wrote: > Given you are sharply criticising the code I authored here, is it too much > to ask for you to cc- me, the author on commentaries like this? Thanks. My mistake, I expected this to get added automatically based on the "Fixes:" tag, I probably dropped you by accident in the end. > On Fri, May 19, 2023 at 11:39:13AM +0200, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> While looking at an unused-variable warning, I noticed a new interface coming >> in that requires the use of IS_ERR_OR_NULL(), which tends to indicate bad >> interface design and is usually surprising to users. > > I am not sure I understand your reasoning, why does it 'tend to indicate > bad interface design'? You say that as if it is an obvious truth. Not > obvious to me at all. > > There are 3 possible outcomes from the function - an error, the function > failing to pin a page, or it succeeding in doing so. For some of the > callers that results in an error, for others it is not an error. > > Overloading EIO on the assumption that gup will never, ever return this > indicating an error seems to me a worse solution. The problem is that we have inconsistent error handling in functions that return an object, about half of them use NULL to indicate an error, and the other half use ERR_PTR(), and users frequently get those wrong by picking the wrong one. Functions that can return both make this worse because whichever of the two normal ways a user expects, they still get it wrong. > Not a fan at all of this patch, it doesn't achieve anything useful, is in > service of some theoretical improvement, and actually introduces a new > class of bug (differentiating EIO and failing to pin). Having another -EIO return code is a problem, so I agree that my patch wouldn't be good either. Maybe separating the error return from the page pointer by passing a 'struct page **p' argument that gets filled would help? Arnd