Request for approval: 6929067: Stack guard pages should be removed when thread is detached
Andreas Kohn
andreas.kohn at fredhopper.com
Thu Mar 18 02:10:38 PDT 2010
On Fri, 2010-03-12 at 09:44 +0000, Andrew Haley wrote:
> On 03/11/2010 09:06 PM, Coleen Phillimore wrote:
> >
> > I've added the test to the changeset and a script to run in our harness.
> >
> > Also in os_linux.cpp, I changed the SYS_gettid call to go through our
> > os::Linux::gettid() because on at least one linux, syscall() returns a
> > long int which gets a compilation warning with %d.
> >
> > open webrev at http://cr.openjdk.java.net/~coleenp/6929067/
> > bug link at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6929067
> >
> > Andrew, please have a look since you're the contributor.
>
> That's OK, but you don't need SYS_gettid.
> Please look at http://cr.openjdk.java.net/~aph/6929067-jdk7-webrev-4/hotspot.patch
> I changed to "/proc/self/maps", as you requested. I think this is better.
>
> The copy of my webrev to cr.openjdk.java.net failed for some reason
> I don't understand.
>
With this change I seem to hit the limit on the number of open files.
Looking through it, shouldn't get_stack_bounds() close the FILE* it
opened?
For example an eclipse process shows this:
/proc/20662/fd>ls -al |grep -c /proc/20662/maps
1917
+static bool
+get_stack_bounds(uintptr_t *bottom, uintptr_t *top)
+{
+ FILE *f = fopen("/proc/self/maps", "r"); <----- that one
+ if (f == NULL)
+ return false;
+
+ while (!feof(f)) {
+ size_t dummy;
+ char *str = NULL;
+ ssize_t len = getline(&str, &dummy, f);
+ if (len == -1) {
+ return false;
+ }
+
+ if (len > 0 && str[len-1] == '\n') {
+ str[len-1] = 0;
+ len--;
+ }
+
+ static const char *stack_str = "[stack]";
+ if (len > (ssize_t)strlen(stack_str)
+ && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) {
+ if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) {
+ uintptr_t sp = (uintptr_t)__builtin_frame_address(0);
+ if (sp >= *bottom && sp <= *top) {
+ free(str);
+ return true;
+ }
+ }
+ }
+
+ free(str);
+ }
+
+ return false;
+}
Regards,
--
Andreas
--
Never attribute to malice that which can be adequately explained by
stupidity. -- Hanlon's Razor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20100318/4a180fea/attachment.bin
More information about the hotspot-dev
mailing list