From: Andries.Brouwer@cwi.nl
To: aebr@win.tue.nl, viro@parcelfarce.linux.theplanet.co.uk
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: [CFT] more kdev_t-ectomy
Date: Sun, 20 Apr 2003 23:17:17 +0200 (MEST) [thread overview]
Message-ID: <UTC200304202117.h3KLHH217162.aeb@smtp.cwi.nl> (raw)
From: viro@parcelfarce.linux.theplanet.co.uk
> So, the interface with filesystems and with userspace has dev_t.
> For kernel-internal numbers kdev_t is better than dev_t.
>
> Of course it may be possible to avoid kernel-internal numbers altogether.
> Sometimes that is an improvement, sometimes not. Pointers are more
> complicated than numbers - they point at something that must be allocated
> and freed and reference counted. A number is like a pointer without the
> reference counting.
Sigh... And what, pray tell, do we do with these numbers? That's
right, at some point(s) we use them to obtain <drumroll> pointers
to driver-supplied objects. And that's where the lack of refcounting,
locking, etc. bites you.
Ha, Al - did you try to understand?
Given a number, one can copy it around freely, without the need
to obtain a reference each time one copies it.
Many of these numbers are just copied around and never used.
In such a case, refcounting is a real waste of time.
But if one really wants to use the number, then a lookup is done,
and one gets a properly refcounted pointer.
So, instead of the dogmatic "numbers are bad", one might try
to estimate the cost of always refcounting versus the cost of
sometimes doing a lookup.
Let's sort that mess out for good. Papering over this stuff won't do
us any good and will only bring more kludgy interfaces. $DEITY witness,
we already have enough of those.
[this sounds like the canonical content-free diatribe]
It's not about pointers vs. numbers - ...
[stuff I completely agree with deleted]
By now all uses of mk_kdev()/major()/minor()/MAJOR()/MINOR() in the drivers
are either trivially removable or represent very real problems. And it's
not that there was a lot of them - in my current tree there's ~85 instances
of kdev_t in the source. And only one of them (->i_rdev) is widely used -
~500 instances, most of them go away as soon as CIDR patch gets merged.
The rest is part noise, part real bugs that need to be fixed anyway
(~40--80 of those).
Yes, I tend to agree. Funny that you do not mention MKDEV - that was
the thing I worked on eliminating long ago.
Andries
next reply other threads:[~2003-04-20 21:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-20 21:17 Andries.Brouwer [this message]
2003-04-20 21:26 ` viro
-- strict thread matches above, loose matches on Subject: below --
2003-04-21 1:32 Andries.Brouwer
2003-04-21 3:54 ` H. Peter Anvin
2003-04-20 23:56 Andries.Brouwer
2003-04-21 0:15 ` H. Peter Anvin
2003-04-21 0:35 ` viro
2003-04-20 21:58 Andries.Brouwer
2003-04-20 22:35 ` viro
2003-04-20 13:31 viro
2003-04-20 15:26 ` Muli Ben-Yehuda
2003-04-20 16:00 ` Andries Brouwer
2003-04-20 19:24 ` viro
2003-04-20 21:10 ` H. Peter Anvin
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=UTC200304202117.h3KLHH217162.aeb@smtp.cwi.nl \
--to=andries.brouwer@cwi.nl \
--cc=aebr@win.tue.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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
all inboxes | Powered by JetHome®