RE: ipc semaphore optimization

Chen, Kenneth W (kenneth.w.chen@intel.com)
Fri, 27 Jun 2003 15:48:22 -0700


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-30962-1056754304-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

Hi Andrew,

> ipc/sem.c changed significantly between 2.5.72 and 2.5.73. Could
> you please update this, retest, resend?
>=20
> Please Cc Manfred on the update too, thanks.

Updated patch relative to 2.5.73, tested and verified. Manfred's change
is in the sem_undo area while this patch is in the wake-up path.

- Ken

--=_courier-30962-1056754304-0001-2
Content-Type: application/octet-stream; name="sem2573.patch"
Content-Transfer-Encoding: base64
Content-Description: sem2573.patch
Content-Disposition: attachment;
filename="sem2573.patch"

ZGlmZiAtTnVyIGxpbnV4LTIuNS43My9pcGMvc2VtLmMgbGludXgtMi41LjczLnNlbS9pcGMvc2Vt
LmMKLS0tIGxpbnV4LTIuNS43My9pcGMvc2VtLmMJU3VuIEp1biAyMiAxMTozMjo0MSAyMDAzCisr
KyBsaW51eC0yLjUuNzMuc2VtL2lwYy9zZW0uYwlGcmkgSnVuIDI3IDE1OjIzOjI2IDIwMDMKQEAg
LTQ5LDYgKzQ5LDEwIEBACiAgKiAgICAgIGluY3JlYXNlLiBJZiB0aGVyZSBhcmUgZGVjcmVtZW50
IG9wZXJhdGlvbnMgaW4gdGhlIG9wZXJhdGlvbnMKICAqICAgICAgYXJyYXkgd2UgZG8gdGhlIHNh
bWUgYXMgYmVmb3JlLgogICoKKyAqIFdpdGggdGhlIGluY2FybmF0aW9uIG9mIE8oMSkgc2NoZWR1
bGVyLCBpdCBiZWNvbWVzIHVubmVjZXNzYXJ5IHRvIHBlcmZvcm0KKyAqIGNoZWNrL3JldHJ5IGFs
Z29yaXRobSBmb3Igd2FraW5nIHVwIGJsb2NrZWQgcHJvY2Vzc2VzIGFzIHRoZSBuZXcgc2NoZWR1
bGVyCisgKiBpcyBiZXR0ZXIgYXQgaG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