From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, vserver@list.linux-vserver.org,
Herbert Poetzl <herbert@13thfloor.at>,
"Serge E. Hallyn" <serue@us.ibm.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Dave Hansen <haveblue@us.ibm.com>,
Arjan van de Ven <arjan@infradead.org>,
Suleiman Souhlal <ssouhlal@FreeBSD.org>,
Hubertus Franke <frankeh@watson.ibm.com>,
Cedric Le Goater <clg@fr.ibm.com>,
Kyle Moffett <mrmacman_g4@mac.com>
Subject: Re: [PATCH 1/5] pid: Implement task references.
Date: Tue, 31 Jan 2006 09:04:14 -0700 [thread overview]
Message-ID: <m1d5i84c5d.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20060131065843.GA24733@kroah.com> (Greg KH's message of "Mon, 30 Jan 2006 22:58:44 -0800")
Greg KH <greg@kroah.com> writes:
> On Mon, Jan 30, 2006 at 01:13:12PM -0700, Eric W. Biederman wrote:
>
> What function would you have to add? A release function? You should
> have that logic somewhere already, so net gain should be the same.
Yes inline in my if statement all 3 lines of it. Adding a function
makes the code less clear.
>> The extra debugging checks in krefs are nice, but not something I
>> am lusting over.
>
> Heh, but they do catch a lot of improper usages.
Agreed.
>> As for code recognition I don't see how recognizing the atomic_t idiom
>> versus the kref idiom is much different. But I haven't had this issue
>> come up in a code review so I have no practical experience there.
>
> It's not a different "idiom", but rather, a way to implement the
> reference counting logic without having to code it all by hand, and
> ensure that you get it correct.
Yes a way to implement the reference counting logic that requires more
lines of code to implement and obscures my code in this instance.
> They are used all the time, and there's not that many atomic_t usages in
> the kernel that do reference counting that have not been already
> converted to use kref (the vfs not-withstanding, for other reasons.)
Well either that is all code that is still to be merged in the
mainline or I am looking with a very different filter than you are.
A quick grep for atomic_t in the kernel include files (filtering
out the asm headers where it was defined) I got several screen fulls
of hits. Things like the network stack, shared process resources are
places I have worked lately and where atomic_t is used, all of the
core bits of the kernel. My similar grep for kref should barely returned
a screen full of hits.
>> So those are all of the nits I can pick. :) I don't kref seems to be
>> a perfectly usable piece of code but not one that seems to help my
>> code. Unless it becomes a mandate from the code correctness police.
>
> As you are adding a new reference count, it is highly encouraged that
> you not reimplement the same logic, but rather use the functions already
> provided in the kernel to do that work for you. That way you don't have
> to write the extra code, and we don't have to check the logic for you.
If there was something to implement I would agree with you. In drivers
out at the fringes of the kernel where looking at some of the code submissions
you wonder if the implementors know C I can totally understand anything
to make things less error prone. But that isn't what this code is.
Given how short my code is and what the effects are I am actually
disappointed that the review only got as far as noticing I was using
an atomic_t. Oh well. Thanks for getting that far.
Eric
next prev parent reply other threads:[~2006-01-31 16:06 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-29 7:19 [RFC][PATCH 0/5] Task references Eric W. Biederman
2006-01-29 7:22 ` [PATCH 1/5] pid: Implement task references Eric W. Biederman
2006-01-29 7:24 ` [PATCH 2/5] pid: Add macros for interating through tasks by type Eric W. Biederman
2006-01-29 7:28 ` [PATCH 3/5] pid: Implement kill_tref Eric W. Biederman
2006-01-29 7:33 ` [PATCH 4/5] vt: Update spawnpid to use a task_ref Eric W. Biederman
2006-01-29 7:35 ` [PATCH 5/5] file: Modify struct fown_struct to contain a tref Eric W. Biederman
2006-01-29 8:43 ` Suleiman Souhlal
2006-01-29 9:18 ` Eric W. Biederman
2006-01-30 10:51 ` [PATCH 4/5] vt: Update spawnpid to use a task_ref Pavel Machek
2006-01-30 20:39 ` Eric W. Biederman
2006-01-30 21:05 ` Pavel Machek
2006-01-30 21:15 ` Eric W. Biederman
2006-01-29 8:46 ` [PATCH 1/5] pid: Implement task references Suleiman Souhlal
2006-01-29 19:05 ` Greg KH
2006-01-29 21:58 ` Eric W. Biederman
2006-01-30 4:51 ` Greg KH
2006-01-30 5:19 ` Eric Dumazet
2006-01-30 5:35 ` Kyle Moffett
2006-01-30 5:46 ` Eric Dumazet
2006-01-30 6:46 ` Kyle Moffett
2006-01-30 18:43 ` Greg KH
2006-01-30 19:58 ` Eric Dumazet
2006-01-30 20:45 ` Eric W. Biederman
2006-01-30 21:32 ` Eric Dumazet
2006-01-30 21:51 ` Eric W. Biederman
2006-01-30 20:13 ` Eric W. Biederman
2006-01-31 6:58 ` Greg KH
2006-01-31 16:04 ` Eric W. Biederman [this message]
2006-01-29 8:05 ` [RFC][PATCH 0/5] Task references Kyle Moffett
2006-02-06 8:09 ` Eric W. Biederman
2006-02-06 14:36 ` Serge E. Hallyn
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=m1d5i84c5d.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=clg@fr.ibm.com \
--cc=frankeh@watson.ibm.com \
--cc=greg@kroah.com \
--cc=haveblue@us.ibm.com \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
--cc=serue@us.ibm.com \
--cc=ssouhlal@FreeBSD.org \
--cc=vserver@list.linux-vserver.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
Powered by JetHome