linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>,
	"'linux-mm@kvack.org'" <linux-mm@kvack.org>
Subject: RE: Silly question: How to map a user space page in kernel space?
Date: Tue, 25 Feb 2003 21:55:57 -0800	[thread overview]
Message-ID: <9860000.1046238956@[10.10.2.4]> (raw)
In-Reply-To: <A46BBDB345A7D5118EC90002A5072C780A7D57E6@orsmsx116.jf.intel.com>

> Hmmm, ok, my scenario is this:
> 
> System call entry point (these are futex modifications),
> kernel/futex.c:futex_wake() and kernel/futex.c:futex_wait(). Both of them
> will require to kmap_atomic a page. When they are talking about the same
> futex (say three guys come in at the same time, one to unlock, two to
> lock), the three of them might end up doing kmap_atomic() over the same
> page. 
> 
> So, are you telling me that for that to work, I have to either:
> 
> - each caller uses a different KM_USER<WHATEVER> [kind of clumsy]
> 
> - I shall protect the kmap_atomic() region with an spinlock, to serialize
> it? [note I have the spinlock already, so it'd be a matter of spinlocking
> _before_ kmap_atomic() instead of after - ugly for a quick consistency
> check, but can live with it].
> 
> I think I still don't really understand what's up with the KM_ flags :]

Well, there's one kmap_atomic slot per type per cpu. So you should be fine
without spinlocks as long as you can't get pushed off the cpu by anything
you do (eg schedule) ... it's really intended for very short use, like: 

kmap
copy thing
kunmap

But be aware that pagefaulting inside kmap_atomic is bad - you can get
blocked and rescheduled, so touching user pages, etc is dangerous. Either
you do some really funky error handling to pick up the pieces if it goes
wrong, or just use regular kmap - you can always convert over later.

M.

--
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:"aart@kvack.org">aart@kvack.org</a>

  reply	other threads:[~2003-02-26  5:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A46BBDB345A7D5118EC90002A5072C780A7D57E6@orsmsx116.jf.intel.com >
2003-02-26  4:44 ` Perez-Gonzalez, Inaky
2003-02-26  5:55   ` Martin J. Bligh [this message]
2003-02-26  8:33     ` Andrew Morton
2003-02-26 19:03       ` Martin J. Bligh
2003-02-26 12:40   ` Mel Gorman
2003-02-26 19:04 Perez-Gonzalez, Inaky
  -- strict thread matches above, loose matches on Subject: below --
2003-02-26 18:57 Perez-Gonzalez, Inaky
2003-02-26 19:01 ` Mel Gorman
     [not found] <A46BBDB345A7D5118EC90002A5072C780A7D57BB@orsmsx116.jf.intel.com >
2003-02-26  3:06 ` Perez-Gonzalez, Inaky
2003-02-26  4:14   ` Martin J. Bligh
2003-02-26  4:39     ` Robert Love
2003-02-21 22:49 Perez-Gonzalez, Inaky
     [not found] <A46BBDB345A7D5118EC90002A5072C780A7D5194@orsmsx116.jf.intel.com >
2003-02-21 22:06 ` Perez-Gonzalez, Inaky
2003-02-21 22:22   ` Martin J. Bligh

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='9860000.1046238956@[10.10.2.4]' \
    --to=mbligh@aracnet.com \
    --cc=inaky.perez-gonzalez@intel.com \
    --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