linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Ask for help on the memory allocation for process shared mutex (resend with plain text)
@ 2014-05-30  2:57 yang ben
  0 siblings, 0 replies; only message in thread
From: yang ben @ 2014-05-30  2:57 UTC (permalink / raw)
  To: linux-kernel, linux-mm

Dear experts,

I came across a memory/mutex issue. Would you kindly shed some light on it?

I use pthread_mutex_xxx API to protect processes in user space. Since
it should be process shared, I allocated a shared memory to store
pthread_mutex_t structure.

The shared memory is allocated using vmalloc_user() and mapped using
remap_vmalloc_range() in driver. However, get_futex_key() will always
return -EFAULT, because page_head->mapping==0.

futex.c (Linux-3.10.31)
         if (!page_head->mapping) {
                 int shmem_swizzled = PageSwapCache(page_head);
                 unlock_page(page_head);
                 put_page(page_head);
                 if (shmem_swizzled)
                         goto again;
                 return -EFAULT;
         }

Is there special requirement on the memory to store mutex? What's the
correct way to allocate such memory in driver?
Thanks in advance!

Regards,
Ben

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-30  2:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-30  2:57 Ask for help on the memory allocation for process shared mutex (resend with plain text) yang ben

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