public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: something funny about tty's on 2.6.4-rc1-mm1
@ 2004-03-03  4:12 Albert Cahalan
  0 siblings, 0 replies; 14+ messages in thread
From: Albert Cahalan @ 2004-03-03  4:12 UTC (permalink / raw)
  To: linux-kernel mailing list; +Cc: akpm, hpa

Andrew Morton writes:

> The (untested) first-fit patch I proposed uses
> a radix tree, so it should in fact be faster
> than the old code.
>
> Are you now thinking that we might need to
> change the pty allocator?

I just re-read Edgar Toernig's comment... oh yeah.
Contemplate BOTH parts of the utmp quote:

: char ut_id[4];     /* init id or abbrev. ttyname */
: ...
: xterm(1) and other terminal emulators directly create
: a USER_PROCESS record and generate the ut_id by using
: the last two letters of /dev/ttyp%c or by using p%d
: for /dev/pts/%d. If they find a DEAD_PROCESS for this
: id, they recycle it, otherwise they create a new entry.

The utmp or utmpx record is about 1/2 a kilobyte.
The records get added to a file. They only get
recycled when the tty is recycled.

So that's a 20 bit minor, 9 bits of utmpx record size...
and thus a file that grows to half a gigabyte.

The reasons are adding up quickly:

1. half-gigabyte utmp,wtmp,wtmpx,utmpx file
2. breaks ut_id, even if 1000 ptys not used
3. a pain to type ("ps -t 1018493")
4. screws up column widths (ps, w, top...)
5. breaks old dev_t, even if 256 ttys not used



^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: something funny about tty's on 2.6.4-rc1-mm1
@ 2004-03-02 19:04 Albert Cahalan
  2004-03-02 19:54 ` H. Peter Anvin
  2004-03-02 22:46 ` Edgar Toernig
  0 siblings, 2 replies; 14+ messages in thread
From: Albert Cahalan @ 2004-03-02 19:04 UTC (permalink / raw)
  To: linux-kernel mailing list; +Cc: hpa, cloos, root, nuno

> As RBJ said, ptys are now recycled in pid-like fashion,
> which means numbers won't be reused until wraparound
> happens.  This is good for security/fault tolerance,
> at least to some minor degree.

Ouch. It's bad for display and bad for typing.
What is easier to type?

ps -t pts/6
ps -t pts/1014962

(and yes, I really type these -- I don't have a
third hand to operate the mouse simultaneously)

What looks better?

UID        PID  PPID  C    SZ  RSS PSR STIME TTY          TIME CMD
albert    3339  2114  0   771 1684   0 Feb26 pts/6    00:00:00 bash
albert    3149  2514  0   771 1684   0 Feb26 pts/1004922 00:00:00 bash
albert    3835  2164  0   771 1684   0 Feb26 pts/8    00:00:00 bash
albert    4136  3114  0   771 1684   0 Feb26 pts/1013866 00:00:00 bash
albert    4739  2119  0   771 1684   0 Feb26 pts/9    00:00:00 bash

Better way:

Have a soft limit, initially set at 99. When 2/3 of
the ptys are in use, increase the soft limit to 999,
then to 9999, 99999, and finally to 999999.

This way, a plain 1-person desktop user would never
have a pty name longer than pts/99 and an insanely
busy server could go as high as needed.



^ permalink raw reply	[flat|nested] 14+ messages in thread
* something funny about tty's on 2.6.4-rc1-mm1
@ 2004-03-01 18:45 Nuno Monteiro
  2004-03-01 19:09 ` Richard B. Johnson
  2004-03-02  5:47 ` H. Peter Anvin
  0 siblings, 2 replies; 14+ messages in thread
From: Nuno Monteiro @ 2004-03-01 18:45 UTC (permalink / raw)
  To: linux-kernel


Hi all,

I just took 2.6.4-rc1-mm1 for a spin, and there's definitely something  
funny about tty's. I left the computer unattended and had visitors over,  
among them small children who, apparently, decided I needed 350 aterm's  
open ;-). So, after they left I issued a 'killall -9 aterm' and fired up  
a new one, and here's something definitely interesting:

nuno@hobbes:~$ w
 18:33:56 up  4:08, 157 users,  load average: 0.03, 0.89, 1.51
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
nuno     :0        14:26   ?xdm?   3:55   0.95s gnome-session
nuno     pts/358   18:30    0.00s  0.10s  0.00s w


I know for a fact that I don't have 157 logged in users (well, there's  
only 45 processes running right now), and shouldn't pts' be recycled, and  
a lower number be assigned? The last kernel I ran was 2.6.3, and none of  
this happened.

My config is:

CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=512

and this is a plain jane static /dev -- not devfs nor udev. Despite the  
supposedly 157 users logged in, /dev/pts only contains '358', which is  
the one allocated to this instance of aterm right now.

nuno@hobbes:~$ ls -l /dev/pts
total 0
crw--w----    1 nuno     users    136, 102 Mar  1 18:41 358

In the mean time I'll fall back to 2.6.3.


Regards,


		Nuno


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-03-03  4:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-03  4:12 something funny about tty's on 2.6.4-rc1-mm1 Albert Cahalan
  -- strict thread matches above, loose matches on Subject: below --
2004-03-02 19:04 Albert Cahalan
2004-03-02 19:54 ` H. Peter Anvin
2004-03-02 22:46 ` Edgar Toernig
2004-03-02 23:59   ` H. Peter Anvin
2004-03-01 18:45 Nuno Monteiro
2004-03-01 19:09 ` Richard B. Johnson
2004-03-02  5:47 ` H. Peter Anvin
2004-03-02 14:52   ` James H. Cloos Jr.
2004-03-02 15:02     ` Richard B. Johnson
2004-03-02 17:47       ` James H. Cloos Jr.
2004-03-02 16:54     ` H. Peter Anvin
2004-03-02 22:08       ` Andrew Morton
2004-03-03  2:29         ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox