[Top] [All Lists]

Re: [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker

To: Tejun Heo <tj@xxxxxxxxxx>
Subject: Re: [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool()
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Jul 2012 22:00:10 -0700
Cc: linux-kernel@xxxxxxxxxxxxxxx, joshhunt00@xxxxxxxxx, axboe@xxxxxxxxx, rni@xxxxxxxxxx, vgoyal@xxxxxxxxxx, vwadekar@xxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxxx, davem@xxxxxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, swhiteho@xxxxxxxxxx, bpm@xxxxxxx, elder@xxxxxxxxxx, xfs@xxxxxxxxxxx, marcel@xxxxxxxxxxxx, gustavo@xxxxxxxxxxx, johan.hedberg@xxxxxxxxx, linux-bluetooth@xxxxxxxxxxxxxxx, martin.petersen@xxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=MV/WYy3MxdtTholxmCXX6fvMVWzudlM9oq57AXujuVo=; b=PRmLAVYFeKGcj6ONnUe3BcrwhxehzjgMCheeK0DTMTKNtbqZg6uR90kM5iC50qT/Dr T/8wP8PrBCYfukQ2ZT3H/k/fZ1aBPBrXd/F5zBhPiRmvrZ4e15TAMocv6HD1BnCeALCz cBHHTDjl2cT1bgVFuGYGztKFPxk72CGxU5NGXXqmG2Tl7sBRi1Nseg5c4AjumrsUgI8h 2gP7pL7LYkui4m/879HD4JOiBwzGyY7AIVnaF1yA/wAlIV9Kq+YlrcECN3dzp0PUQJL/ xsIqYH7Os1E1QsZuk/PnPhjLJGYMp2QFiAMphSwqsSUC6JbB8MOctJJPDv2NO+g5ioKB EWoQ==
In-reply-to: <20120714044438.GA7718@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <1341859315-17759-1-git-send-email-tj@xxxxxxxxxx> <1341859315-17759-6-git-send-email-tj@xxxxxxxxxx> <20120714035538.GB5638@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <CA+55aFyeauqCqrWsx4U2TB2ENrugZXYj+4vw3Fd0kGaeWBP3RA@xxxxxxxxxxxxxx> <20120714044438.GA7718@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: linus971@xxxxxxxxx
On Fri, Jul 13, 2012 at 9:44 PM, Tejun Heo <tj@xxxxxxxxxx> wrote:
> nr_running is atomic_t (*nr_running)[2].  Ignoring the pointer to
> array part, it's just returning the address of N'th element of the
> array.  ARRAY + N == &ARRAY[N].

None of this matters one whit.

You did "&(x)[0]".

That's insane. It's crazy. It doesn't even matter what "x" is in
between, it's crazy regardless.

It's just a really confused way of saying "x" (*). Except it makes the
code look like an insane monkey on crack got a-hold of your keyboard
when you weren't looking.

And to make it worse, "x" itself was the result of doing "*&y". Which
was probably written by the insane monkey's older brother, Max, who
has been chewing Quaaludes for a few years, and as a result _his_
brain really isn't doing too well either. Even for a monkey. And now
you're letting *him* at your keyboard too?

So you had two separately (but similarly) insane ways of complicating
the code so that it was really obfuscated. When it really just
computed "y" to begin with, it just added all those "x=*&y" and
"&(x)[0]" games around it to make it look complicated.


(*) Technically, "&(x)[0]" is actually a really confused way of saying
"(x+0)" while making sure that "x" was a valid pointer. It basically
guarantees that if "x" started out as an array, it has now been
demoted to a pointer - but since arrays will be demoted to pointers by
pretty much any subsequent operation except for "sizeof()" and a
couple of other special cases anyway, you can pretty much just say
that "&(x)[0]" is "(x+0)" is "x".

And "*&y" really is exactly the same as "y", except for again some
syntactic checking (ie it is basically an odd way to verify that "y"
is an lvalue, since you cannot do an address-of of a non-lvalue).

<Prev in Thread] Current Thread [Next in Thread>