* [PATCH] docs/core-api: memory-allocation: add mention of kmem_cache_create_userspace
@ 2019-01-14 11:47 Mike Rapoport
2019-01-15 0:27 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Mike Rapoport @ 2019-01-14 11:47 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, linux-mm, Mike Rapoport
Mention that when a part of a slab cache might be exported to the
userspace, the cache should be created using kmem_cache_create_usercopy()
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
Documentation/core-api/memory-allocation.rst | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/core-api/memory-allocation.rst b/Documentation/core-api/memory-allocation.rst
index 8954a88..51a200d 100644
--- a/Documentation/core-api/memory-allocation.rst
+++ b/Documentation/core-api/memory-allocation.rst
@@ -113,9 +113,11 @@ see :c:func:`kvmalloc_node` reference documentation. Note that
If you need to allocate many identical objects you can use the slab
cache allocator. The cache should be set up with
-:c:func:`kmem_cache_create` before it can be used. Afterwards
-:c:func:`kmem_cache_alloc` and its convenience wrappers can allocate
-memory from that cache.
+:c:func:`kmem_cache_create` or :c:func:`kmem_cache_create_usercopy`
+before it can be used. The second function should be used if a part of
+the cache might be copied to the userspace. After the cache is
+created :c:func:`kmem_cache_alloc` and its convenience wrappers can
+allocate memory from that cache.
When the allocated memory is no longer needed it must be freed. You
can use :c:func:`kvfree` for the memory allocated with `kmalloc`,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] docs/core-api: memory-allocation: add mention of kmem_cache_create_userspace
2019-01-14 11:47 [PATCH] docs/core-api: memory-allocation: add mention of kmem_cache_create_userspace Mike Rapoport
@ 2019-01-15 0:27 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2019-01-15 0:27 UTC (permalink / raw)
To: Mike Rapoport; +Cc: linux-doc, linux-kernel, linux-mm
On Mon, 14 Jan 2019 13:47:34 +0200
Mike Rapoport <rppt@linux.ibm.com> wrote:
> Mention that when a part of a slab cache might be exported to the
> userspace, the cache should be created using kmem_cache_create_usercopy()
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Hmm...I didn't know that :)
Applied, thanks.
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-15 0:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 11:47 [PATCH] docs/core-api: memory-allocation: add mention of kmem_cache_create_userspace Mike Rapoport
2019-01-15 0:27 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).