From: yang ben <benyangfsl@gmail.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Ask for help on the memory allocation for process shared mutex
Date: Fri, 30 May 2014 10:43:36 +0800 [thread overview]
Message-ID: <CAGO-9mo8aSBABPMzik0_gekUu=E2nxHk8DK7He_kQvHEBaU8HA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1280 bytes --]
reply other threads:[~2014-05-30 2:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGO-9mo8aSBABPMzik0_gekUu=E2nxHk8DK7He_kQvHEBaU8HA@mail.gmail.com' \
--to=benyangfsl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox