Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fifo allocate all task stacks from the Chapel heap #2149

Closed
wants to merge 5 commits into from

Conversation

mppf
Copy link
Member

@mppf mppf commented Jul 8, 2015

I ran into problems when experimenting with ugni+fifo and --cache-remote.
The problem was that UGNI does not support get_nb for addresses
that are not in the segment - and that includes task stacks.

So, this patch does two things:

  1. Updates threads-pthreads.c to allocate task stacks from the Chapel heap and then associates that with the pthread_create call through pthread_attr_setstack.
  2. Updates chpl_task_callMain in tasks-fifo.c to execute chpl_main in a pthread with an appropriately allocated stack.

Greg and I have talked about wanting both

  • comms layers to handle out-of-segment operations; and
  • tasking layers to allocate stacks from the registered segment.

One question: should these stacks ever be freed?
Passed full local testing.

@mppf
Copy link
Member Author

mppf commented Jul 8, 2015

@gbtitus, can you look at this?

@mppf
Copy link
Member Author

mppf commented Jul 15, 2015

  • create guard pages; use mprotect to set no access on guard page
  • un-mprotect and free all task stacks after joining with all pthreads in chpl_task/thread_exit().
  • fix cache for remote data to only prefetch to page boundary, using the segment's page size
  • pull chplsys.c and chpl-mem.c changes to other PRs

@mppf mppf assigned mppf and unassigned gbtitus Jul 15, 2015
@mppf mppf closed this Jul 15, 2015
mppf added a commit that referenced this pull request May 4, 2016
Fifo task stacks allocated in Chapel heap memory

[PR prepared by @Panzone, merged by @mppf]


This pull request modifies the fifo tasks, making them to use a chapel-allocated memory area as their stack. This PR is a continuation of the work done in PR #2149.

On some occasions the stack isn’t allocated in a chapel-allocated memory area because the runtime can’t currently generate a guard page for the stack in those occasions.

It passes all local tests in test/runtime and test/release on both linux64 and darwin using both cstdlib and jemalloc

I’ve also test it using a simple, infinite recursive proc on darwin (using both cstdlib and jemalloc) and I’ve manually checked the addresses for seeing if the access to the guard page blocked the application.

[Reviewed by @gbtitus and @mppf]
[Also passed release/examples with fifo+ugni+huge pages]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants