From: Eric Dumazet <eric.dumazet@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
Matthew Wilcox <mawilcox@microsoft.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] radix-tree: must check __radix_tree_preload() return value
Date: Tue, 05 Sep 2017 11:34:35 -0700 [thread overview]
Message-ID: <1504636475.15310.60.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <CA+55aFwNK39yB_wbwKSkk4VfLSxALzeZHT6dShpT1zZdpmeq1Q@mail.gmail.com>
On Tue, 2017-09-05 at 11:07 -0700, Linus Torvalds wrote:
> On Tue, Sep 5, 2017 at 10:59 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > @@ -2104,7 +2104,10 @@ EXPORT_SYMBOL(radix_tree_tagged);
> > */
> > void idr_preload(gfp_t gfp_mask)
> > {
> > - __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> > + int ret = __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> > +
> > + if (ret)
> > + preempt_disable();
> > }
> > EXPORT_SYMBOL(idr_preload);
>
> Is there a reason for the "ret" variable that is entirely mis-named,
> since it's never actually used as a return value?
>
> (Sure. it's the return value of a function, but that is entirely
> useless and pointless information, and adds no value. We should name
> variables by the data they contain or how they are used, not by "it
> was the return value of a function").
>
> In other words, why isn't this just
>
> if (__radix_tree_preload(..))
> preempt_disable();
>
> which is shorter and clearer and not confusing?
...
> Same issue, but this time strengthened by an additional "why doesn't
> this just use that idr_preload function then?" question..
>
Yep, I will send a v2, thanks.
next prev parent reply other threads:[~2017-09-05 18:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 17:59 [PATCH] radix-tree: must check __radix_tree_preload() return value Eric Dumazet
2017-09-05 18:07 ` Linus Torvalds
2017-09-05 18:34 ` Eric Dumazet [this message]
2017-09-05 18:46 ` [PATCH v2] " Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504636475.15310.60.camel@edumazet-glaptop3.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mawilcox@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox