Larger dev_t
From [email protected] Sun Mar 25 05:26:51 2001
On Sat, 24 Mar 2001 [email protected] wrote:
>
> We need a size, and I am strongly in favor of sizeof(dev_t) = 8; > this is already true in glibc.
The fact that glibc is a quivering mass of bloat, and total and utter crap makes you suggest that the Linux kernel should try to be as similar as possible?
Not a very strong argument.
There is no way in HELL I will ever accept a 64-bit dev_t.
I don't care one _whit_ about the fact that Ulrich Drepper thinks that it's a good idea to make things too large.
Funny.
Now what I wrote is that *I* am strongly in favor of sizeof(dev_t) = 8. You think that I want bloat - in reality sizeof(dev_t) = 8 makes life simpler.
My system here has for example in super.c:
static dev_t next_unnamed_device = 0x10000000000ULL;
kdev_t get_unnamed_dev(void) {
return to_kdev_t(next_unnamed_device++);
}void put_unnamed_dev(kdev_t dev) {
}
a large name space allows one to omit checking what part can be reused - reuse is unnecessary. That is also why I use a 64-bit pid:
upon a fork one does not have to search for pids, pgrps, sessions with a given pid, and getpid() can be
static int get_pid(unsigned long flags) {
if (flags & CLONE_PID)
return current->pid;
spin_lock(&lastpid_lock);
++last_pid;
spin_unlock(&lastpid_lock);
return last_pid;
}fast, simple, avoiding obscure security problems.
Yes, a large name space makes life simpler.
Now concerning this dev_t:
Outside the kernel we have glibc and it is 64 bits. Inside the kernel we have a pointer to a device struct. The kernel idea of the size of dev_t only plays a role on the system call interface.
Really, I see no advantages at all restricting the interface to something smaller than what user space and kernel use. And saying "12 bits is enough for a major" somehow sounds funny.
Andries
In article <[email protected]>,
Quoted 2 lines · <[email protected]> wrote:
a large name space allows one to omit checking what part can be reused - reuse is unnecessary.
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
Wichert.
Signature · 4 lines
________________________________________________________________ / Generally uninteresting signature - ignore at your convenience \ | [email protected] http://www.liacs.nl/~wichert/ | | 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |
Quoted 2 lines · Wichert Akkerman
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
64 bits is enough to fork 1 million processes per second for over 500,000 years. I think that's putting the problem off far enough.
-Mitch
Review
Quoted 9 lines
Quoted 2 lines · Wichert Akkerman
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
64 bits is enough to fork 1 million processes per second for over 500,000 years. I think that's putting the problem off far enough.
(quoted diff) +0
-2-Mitch -
Ever thought about how you would kill a process: kill -9 127892752 doesn't sound very appealing to me.
So you'd also need to implement a mechanism that allows for 'easy' selection of processes to kill, for example giving every process with the same name a unique identifier (like httpd_0, httpd_1, httpd_2 and so on).
Quoted 7 lines · Michel Wilson
Quoted 7 lines
Quoted 2 lines · Wichert Akkerman
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
64 bits is enough to fork 1 million processes per second for over 500,000 years. I think that's putting the problem off far enough.
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +0
-2-Mitch -Ever thought about how you would kill a process: kill -9 127892752 doesn't sound very appealing to me.
So you'd also need to implement a mechanism that allows for 'easy' selection of processes to kill, for example giving every process with the same name a unique identifier (likehttpd_0,httpd_1,httpd_2and so on).
Ever heard of cut-and-paste? Surely you can afford a mouse... And for when you you are not inputting manually but running a script/whatever, who cares what the numbers are...
Cheers,
Anton
Signature · 3 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://sourceforge.net/projects/linux-ntfs/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
Quoted 9 lines
Ever heard of cut-and-paste? Surely you can afford a mouse... And for when
you you are not inputting manually but running a script/whatever, who cares
what the numbers are...Cheers,
Anton
Oops. Okay, you're right.
Quoted 2 lines · Michel Wilson
Ever thought about how you would kill a process: kill -9 127892752 doesn't sound very appealing to me.
man killall(1). Kill processes by name.
Quoted 3 lines
So you'd also need to implement a mechanism that allows for 'easy' selection of processes to kill, for example giving every process with the same name a unique identifier (like
httpd_0,httpd_1,httpd_2and so on).
huh?
Signature · 3 lines
Jeff Garzik | May you have warm words on a cold evening, Building 1024 | a full moon on a dark night, MandrakeSoft | and a smooth road all the way to your door.
Quoted 6 lines · Mitchell Blank Jr
Quoted 2 lines · Wichert Akkerman
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
64 bits is enough to fork 1 million processes per second for over 500,000 years. I think that's putting the problem off far enough.
The year is 2006. IBM's latest supercluster has 1000 boxes, each with 4 x 8-way SMT processors running at 1THz. Dense optical interconnect provides NUMA-style cache coherency, and the entire system runs like a giant SMP box (using kernel data structure replication). Each active thread is able to clone() 500,000,000 threads per second, in a pid space shared throughout the cluster.
A virus arrives containing while(1){clone();}
Engineers observe pid wraparound approximately 2 weeks later :-)
-- Jamie
Ok, i don't really know much about the kernel at all, but here's my opinion anyway..
To use 64bit pids when 32bit is enough just to "make things easier" doesn't sound like a good idea to me. Eventually it might wrap around (fx. as on that supercomputer Jamie Lokier talked about) to overwrite running processes, and cause death and destruction. Bye bye stability.
Even if it doesn't wrap, using double the space necessarry for something every single process has is a waste of space. Linux is supposed to be able to run on a large range of systems, and some of them don't have that kind of luxury. Sure, the kernel can be modified for those (rare) cases, but still, using something that's not necessary just sounds like bad practice to me..
Never assume luxury..
Gerry
Quoted 9 lines · Wichert Akkerman
In article <[email protected]>,
Quoted 2 lines · <[email protected]> wrote:
a large name space allows one to omit checking what part can be reused - reuse is unnecessary.
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
Wichert.
Yes indeed. If my box, after continually spawning 1000000000 processes per second for 500 years crashes because pid_t overflows, I'll think about whether I should put the test back in, or should upgrade to a 128-bit machine.
Andries
Quoted 9 lines · Guest section DW
Quoted 8 lines · Wichert Akkerman
In article <[email protected]>,
Quoted 2 lines · <[email protected]> wrote:
a large name space allows one to omit checking what part can be reused - reuse is unnecessary.
You are just delaying the problem then, at some point your uptime will be large enough that you have run through all 64bit pids for example.
Quoted 6 lines
Quoted 1 line
Wichert.
Yes indeed. If my box, after continually spawning 1000000000 processes per second for 500 years crashes because
pid_toverflows, I'll think about whether I should put the test back in, or should upgrade to a 128-bit machine.
this is a no point thread, we are not going to live 500 years? a 64 bits space is more that we are going to need anyway...
Juan Diego
Quoted 5 lines · On Sun, 25 Mar 2001 [email protected] wrote:
Now what I wrote is that *I* am strongly in favor of
sizeof(dev_t)= 8. You think that I want bloat - in realitysizeof(dev_t)= 8 makes life simpler.
Quoted 7 lines
My system here has for example in
super.c:static
dev_tnext_unnamed_device=0x10000000000ULL;kdev_t get_unnamed_dev(void) { return to_kdev_t(next_unnamed_device++); }
Fine.
You'e now forced every piece of code that needs a dev_t to carry along the overhead of having a 64-bit field, for the advantage of making "get_unnamed_dev()" smaller and faster.
The thing is, I have _never_ EVER seen "get_unnamed_dev()" on any kernel profile.
And I don't remember when (if ever) we had a bug in it.
So the advantage of making it smaller/faster/simpler seems to be a purely theoretical one.
Quoted 4 lines
a large name space allows one to omit checking what part can be reused - reuse is unnecessary. That is also why I use a 64-bit pid:
upon a fork one does not have to search for pids, pgrps, sessions with a given pid, andgetpid()can be
Hey, 5 years ago we could have said the same for a 32-bit pid.
The fact is, that there are programs out there that use "int" for pids.
It's equally true that changing "pid_t" will require that you recompile every single app that might have a kernel interface to the current 32-bit pid_t.
AND you just created tons of problems for things like the non-obvious stuff like
ioctl(fd, FASETOWN, arg);
because "arg" is defined to be a single word.
In short, you've just broken existing binaries in ways that will be _damn_ hard to debug (they magically start breaking only after the pid-space has wrapped the first 32 bits).
And that's a DOCUMENTED interface. Never mind all the undocumented stuff that assumes (for all the reasonable historical reasons) that "pid" fits in an "int". Tell me there aren't applications like that, and I'll laugh in your face.
In short, both your arguments are totally bogus. Your "simpler" function is in fact a horrible rats nest and a source of subtle bugs that you apparently never even thought about.
And that's without ever actually mentioning the word "bloat" and "data cache usage".
Linus