xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com,
	jbeulich@suse.com, keir@xen.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 3/4] tmem: drop unnecessary lock in tmem_relinquish_pages()
Date: Wed, 30 Apr 2014 16:29:15 -0400	[thread overview]
Message-ID: <1398889756-16352-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1398889756-16352-1-git-send-email-konrad.wilk@oracle.com>

From: Bob Liu <bob.liu@oracle.com>

CID 1150562

tmem_rwlock is unnecessary in tmem_relinquish_pages(), as
such lock is used as gate for hypercalls. However
tmem_relinquish_pages deals with pages that are no longer
owned by any domain - hence there is no need for tmem_rwlock.

Also the function is protected by the 'heap_lock' which
is the only calleer of this function.

This patch drops said lock.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/common/tmem.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index f7f828f..f2dc26e 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -2794,9 +2794,6 @@ void *tmem_relinquish_pages(unsigned int order, unsigned int memflags)
         return NULL;
     }
 
-    if ( memflags & MEMF_tmem )
-        read_lock(&tmem_rwlock);
-
     while ( (pfp = tmem_page_list_get()) == NULL )
     {
         if ( (max_evictions-- <= 0) || !tmem_evict())
@@ -2812,9 +2809,6 @@ void *tmem_relinquish_pages(unsigned int order, unsigned int memflags)
         relinq_pgs++;
     }
 
-    if ( memflags & MEMF_tmem )
-        read_unlock(&tmem_rwlock);
-
     return pfp;
 }
 
-- 
1.8.5.3

  parent reply	other threads:[~2014-04-30 20:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 20:29 [PATCH] tmem fixes for Xen 4.5 - coverity inspired Konrad Rzeszutek Wilk
2014-04-30 20:29 ` [PATCH 1/4] xc/tmem: Free temporary buffer used during migration Konrad Rzeszutek Wilk
2014-04-30 20:43   ` Andrew Cooper
2014-04-30 20:29 ` [PATCH 2/4] xc/tmem: Unchecked return value (v2) Konrad Rzeszutek Wilk
2014-04-30 20:46   ` Andrew Cooper
2014-04-30 20:29 ` Konrad Rzeszutek Wilk [this message]
2014-04-30 20:29 ` [PATCH 4/4] tmem: fix Out-of-bounds read reported by Coverity Konrad Rzeszutek Wilk
2014-04-30 21:04   ` Andrew Cooper
2014-05-04  8:10     ` Bob Liu
2014-05-05 11:08       ` Andrew Cooper

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=1398889756-16352-4-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).