linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Question about pte_offset_map_lock
@ 2009-12-17  2:46 Minchan Kim
  2009-12-17  8:01 ` Peter Zijlstra
  2009-12-17  9:54 ` Hugh Dickins
  0 siblings, 2 replies; 5+ messages in thread
From: Minchan Kim @ 2009-12-17  2:46 UTC (permalink / raw)
  To: linux-mm; +Cc: Hugh Dickins, Christoph Lameter, Peter Zijlstra,
	KAMEZAWA Hiroyuki

It may be a dumb question.

As I read the code of pte_lock, I have a question. 
Now, there is pte_offset_map_lock following as. 

#define pte_offset_map_lock(mm, pmd, address, ptlp)     \
({                                                      \
        spinlock_t *__ptl = pte_lockptr(mm, pmd);       \
        pte_t *__pte = pte_offset_map(pmd, address);    \
        *(ptlp) = __ptl;                                \
        spin_lock(__ptl);                               \
        __pte;                                          \
})

Why do we grab the lock after getting __pte?
Is it possible that __pte might be changed before we grab the spin_lock?

Some codes in mm checks original pte by pte_same. 
There are not-checked cases in proc. As looking over the cases,
It seems no problem. But in future, new user of pte_offset_map_lock 
could mistake with that?

-- 
Kind regards,
Minchan Kim

--
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] 5+ messages in thread

end of thread, other threads:[~2009-12-17 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17  2:46 Question about pte_offset_map_lock Minchan Kim
2009-12-17  8:01 ` Peter Zijlstra
2009-12-17 14:49   ` Minchan Kim
2009-12-17  9:54 ` Hugh Dickins
2009-12-17 15:02   ` Minchan Kim

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