lkml.org 
[lkml]   [2012]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] m2p_find_override: use list_for_each_entry_safe
On Tue, Mar 27, 2012 at 02:52:44PM +0100, Stefano Stabellini wrote:
> Use list_for_each_entry_safe and remove the spin_lock acquisition in
> m2p_find_override.

So this would allow us to get stale entries. Is that OK?

>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
> arch/x86/xen/p2m.c | 8 ++------
> 1 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index 1b267e7..7ed8cc3 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -809,21 +809,17 @@ struct page *m2p_find_override(unsigned long mfn)
> {
> unsigned long flags;
> struct list_head *bucket = &m2p_overrides[mfn_hash(mfn)];
> - struct page *p, *ret;
> + struct page *p, *t, *ret;
>
> ret = NULL;
>
> - spin_lock_irqsave(&m2p_override_lock, flags);
> -
> - list_for_each_entry(p, bucket, lru) {
> + list_for_each_entry_safe(p, t, bucket, lru) {
> if (page_private(p) == mfn) {
> ret = p;
> break;
> }
> }
>
> - spin_unlock_irqrestore(&m2p_override_lock, flags);
> -
> return ret;
> }
>
> --
> 1.7.2.5


\
 
 \ /
  Last update: 2012-03-27 16:45    [W:0.066 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site