linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Fawad Lateef <fawadlateef@gmail.com>
To: James Courtier-Dutton <James@superbug.demon.co.uk>
Cc: linux-mm@kvack.org
Subject: Re: Kernel tempory memory alloc
Date: Sat, 19 Nov 2005 23:57:19 +0500	[thread overview]
Message-ID: <1e62d1370511191057i5ab0b4b3ve3c8a2a3dcabe6fe@mail.gmail.com> (raw)
In-Reply-To: <437F1E7F.40504@superbug.demon.co.uk>

On 11/19/05, James Courtier-Dutton <James@superbug.demon.co.uk> wrote:
>
> The IOCTL will be a simple request/response type, so the memory
> allocation will be for a very short time. Which is the correct memory
> api to use when allocating short term temporary memory in the kernel.

I mostly/vastly used and saw memory allocation API "kmalloc" for small
memory allocations. And for short-term and fast memory allocation use
GFP_ATOMIC flag with memory allocation functions!

> Alternatively, is there a way to handle this by simply moving a page
> from user space to kernel space and then back to user space again?
> Thus reducing the amount of memcpy.
>

I think memcpy is not a big-overhead as compare to temporary mapping a
page from user space to kernel space and then unmapping it each time
an ioctl is called, so you might try to constantly share a buffer
between user/kernel space through which you can access data directly
from both spaces (for mapping user page in kernel you can see
get_user_pages) !


--
Fawad Lateef

--
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>

  reply	other threads:[~2005-11-19 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-19 12:45 James Courtier-Dutton
2005-11-19 18:57 ` Fawad Lateef [this message]
2005-11-19 23:54   ` Andi Kleen

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=1e62d1370511191057i5ab0b4b3ve3c8a2a3dcabe6fe@mail.gmail.com \
    --to=fawadlateef@gmail.com \
    --cc=James@superbug.demon.co.uk \
    --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