Re: [PATCH] processes with shared vm

Terje Eggestad (te@scali.no)
Sat, 18 Aug 2001 15:29:23 +0200 (CEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---99957877-1556444039-998141363=:6444
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Fri, 17 Aug 2001, Dave McCracken wrote:

> --On Friday, August 17, 2001 22:55:37 +0200 Andi Kleen <ak@suse.de> wrote:
>
> > Even with a tgid you would need some way to avoid its counter wrapping
> > and getting reused.
>
> While in theory the pid that is used for tgid should never die while the
> thread group exists, this case needs to be handled for thread groups in
> general. The number shouldn't be re-used for a pid as long as it's in use
> as a tgid.

Be careful, I tested by using _clone() dircetly and let a proc A
create two clones B and C. I then let A die, and B &C's ppid was now 1.
Attaching this code, you may find it useful for your tgid patch.
(this code is pretty unclean, ran into the problem that if A cloned B
and B cloned C, and now B died B remained a zombie and I didn't seem to
be able to catch SIGCHLD in A. (wanted to se C's ppid go to 1), probably
something stupid, just didn't bother to pursue it....)

THeory is correct if every one is using pthreads...
(exactly how many thread libs are ut there.....??)

>
> > Also gtop should display correct results even with the programs
> > that don't use CLONE_THREAD.
>
> Are there any programs that use CLONE_VM and not CLONE_THREAD?

attached program ;-)
Maybe not, but *the kernel allows it*!

>
> Actually I think we should make tgid visible in /proc in general because
> it's a useful thing to know, whether it's the right mechanism for gtop or
> not. I'll work up a patch.

Looking forward to it!

>
> Dave McCracken
>
> ======================================================================
> Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
> dmccr@us.ibm.com T/L 678-3059
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

TJ

-- 
_________________________________________________________________________

Terje Eggestad terje.eggestad@scali.no Scali Scalable Linux Systems http://www.scali.com

Olaf Helsets Vei 6 tel: +47 22 62 89 61 (OFFICE) P.O.Box 70 Bogerud +47 975 31 574 (MOBILE) N-0621 Oslo fax: +47 22 62 89 51 NORWAY _________________________________________________________________________

---99957877-1556444039-998141363=:6444 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="clone.c" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.LNX.4.30.0108181529230.6444@elin.scali.no> Content-Description: Content-Disposition: attachment; filename="clone.c"

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RkbGliLmg+DQojaW5j bHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8ZXJybm8uaD4NCiNpbmNsdWRl IDxzeXMvdHlwZXMuaD4NCiNpbmNsdWRlIDxzaWduYWwuaD4NCiNpbmNsdWRl IDxzY2hlZC5oPg0KDQoNCnBpZF90IHBpZDAsIHBpZDEsIHBpZDI7DQpjaGFy ICogc3RhY2sxLCAqIHN0YWNrMjsNCg0KI2RlZmluZSBTVEFDS1NJWkUgMTAy NCo4KjQNCg0Kc3RydWN0IHNpZ2NhbGx7DQogIGludCBzaWc7DQogIHBpZF90 IHBpZDsNCn0gc2lnbGlzdFsxMDI0XTsNCmludCBuc2lnID0gMDsNCg0KcHJp bnRmc2lnbGlzdCgpDQp7DQogIGludCBpOw0KICBmb3IgKGkgPSAwOyBpPCBu c2lnOyBpKyspIA0KICAgIHByaW50ZigiJWQ6OiAlZDogJWQgJWRcbiIsIGdl dHBpZCgpLCBpLCBzaWdsaXN0W25zaWddLnBpZCwgc2lnbGlzdFtuc2lnXS5z aWcpOw0KfTsNCg0Kdm9pZCBzaWdoYW5kKGludCBzaWcpDQp7DQogIHNpZ2xp c3RbbnNpZ10ucGlkID0gZ2V0cGlkKCk7DQogIHNpZ2xpc3RbbnNpZ10uc2ln ID0gc2lnOw0KICBuc2lnKys7DQp9DQoNCmludCBjbG9uZTIoKQ0Kew0KDQog IHBpZDIgPSBnZXRwaWQoKTsNCiAgcHJpbnRmKCJjbG9uZTIgaGFzIHBpZCAl Z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BoYXMgcGlkICVk XG4iLCBwaWQyKTsNCg0KICBleGl0KDIpOw0KDQoNCn07DQogIA0K ---99957877-1556444039-998141363=:6444-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/