xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Anisov <andrii.anisov@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, andrii_anisov@epam.com,
	George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, tim@xen.org, paul.durrant@citrix.com,
	jbeulich@suse.com, wei.liu2@citrix.com
Subject: [RFC 4/6] rangeset_domain_destroy() refactoring
Date: Thu, 16 Feb 2017 14:03:28 +0200	[thread overview]
Message-ID: <1487246610-8298-5-git-send-email-andrii.anisov@gmail.com> (raw)
In-Reply-To: <1487246610-8298-1-git-send-email-andrii.anisov@gmail.com>

From: Andrii Anisov <andrii_anisov@epam.com>

rangeset_domain_destroy() is rather rangeset list helper and does nothing really
domain specific. So replace it with rangeset_list_destroy() helper.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
---
 xen/common/domain.c        |  4 ++--
 xen/common/rangeset.c      | 11 ++++-------
 xen/include/xen/rangeset.h |  9 ++-------
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7fe69c6..47c45f2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -420,7 +420,7 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
         radix_tree_destroy(&d->pirq_tree, free_pirq_struct);
     }
     if ( init_status & INIT_rangeset )
-        rangeset_domain_destroy(d);
+        rangeset_list_destroy(&d->rangesets);
     if ( init_status & INIT_watchdog )
         watchdog_domain_destroy(d);
     if ( init_status & INIT_xsm )
@@ -815,7 +815,7 @@ static void complete_domain_destroy(struct rcu_head *head)
 
     watchdog_domain_destroy(d);
 
-    rangeset_domain_destroy(d);
+    rangeset_list_destroy(&d->rangesets);
 
     sched_destroy_domain(d);
 
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 1a13a32..a8b5a5d 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -381,20 +381,17 @@ void rangeset_limit(
     r->nr_ranges = limit;
 }
 
-void rangeset_domain_destroy(
-    struct domain *d)
+void rangeset_list_destroy(struct list_head *list)
 {
     struct rangeset *r;
 
-    while ( !list_empty(&d->rangesets) )
+    while ( !list_empty(list) )
     {
-        r = list_entry(d->rangesets.next, struct rangeset, rangeset_list);
+        r = list_entry(list->next, struct rangeset, rangeset_list);
 
-        BUG_ON(r->domain != d);
-        r->domain = NULL;
         list_del(&r->rangeset_list);
 
-        rangeset_destroy(r);
+        rangeset_destroy(r, NULL);
     }
 }
 
diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h
index e8244a0..cc795d1 100644
--- a/xen/include/xen/rangeset.h
+++ b/xen/include/xen/rangeset.h
@@ -18,14 +18,9 @@ struct spinlock;
 struct rangeset;
 
 /*
- * Destroy per-domain rangeset information.
- * 
- * It is invalid to create or destroy a rangeset belonging to a domain @d
- * before rangeset_domain_initialise(d) returns or after calling
- * rangeset_domain_destroy(d).
+ * Destroy a list of rangesets.
  */
-void rangeset_domain_destroy(
-    struct domain *d);
+void rangeset_list_destroy(struct list_head *list);
 
 /*
  * Create a rangeset. Optionally attach to a specified list @head.
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-02-16 12:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 12:03 [RFC 0/6] Rangeset generalisation Andrii Anisov
2017-02-16 12:03 ` [RFC 1/6] rangeset_new() refactoring Andrii Anisov
2017-02-16 12:14   ` Paul Durrant
2017-02-16 13:15     ` Andrii Anisov
2017-02-16 12:03 ` [RFC 2/6] rangeset_destroy() refactoring Andrii Anisov
2017-02-16 12:26   ` Paul Durrant
2017-02-16 14:26     ` Andrii Anisov
2017-02-16 14:29       ` Paul Durrant
2017-02-16 16:22         ` Andrii Anisov
2017-02-16 16:37           ` Paul Durrant
2017-02-16 12:03 ` [RFC 3/6] Drop rangeset_domain_initialise() Andrii Anisov
2017-02-16 12:03 ` Andrii Anisov [this message]
2017-02-16 12:03 ` [RFC 5/6] rangeset_domain_printk() refactoring Andrii Anisov
2017-02-16 12:03 ` [RFC 6/6] Drop domain remains from rangeset Andrii Anisov
2017-02-16 12:29 ` [RFC 0/6] Rangeset generalisation Paul Durrant
2017-02-16 12:45   ` Andrii Anisov
2017-02-16 12:50     ` Paul Durrant
2017-02-16 13:07       ` Andrii Anisov
2017-02-16 13:24       ` Andrii Anisov
2017-02-16 14:02         ` Paul Durrant
2017-02-16 14:28           ` Andrii Anisov
2017-02-16 13:25     ` Jan Beulich
2017-02-16 13:37       ` Andrii Anisov
2017-02-16 13:42       ` Andrii Anisov
2017-02-16 14:30         ` Jan Beulich
2017-02-16 17:39           ` George Dunlap

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=1487246610-8298-5-git-send-email-andrii.anisov@gmail.com \
    --to=andrii.anisov@gmail.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=andrii_anisov@epam.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=paul.durrant@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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).