From nobody Mon Feb 9 22:24:26 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559039709; cv=none; d=zoho.com; s=zohoarc; b=M56YufjjsjZwT1+C66jXoxTFu9/LJsnKtG2OJQbDBeY9LcHAGhROrRqnO4dRcojHvIhd2ifdv9G0w71b2PJ6n+o5dIVPv0oMRuSg7LUQCFpIao7GoxtSFsU9DgM7HqL41F+ydo2pzjHSJPjR7z2FBp6HPMSvmB3YnKUU8DjfdXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559039709; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ACSboxoylyi1iGP7j6fa1YB386porywgy9MxZsABhVE=; b=L1LLhalc00cw4DeNMgN8iFYV7EbpJvNCE3Uw5WAS1aEm4x8vqh8so+v1Q1kvZacdIkstP+V+TdNtmPCmRQEUeDB7CjbctTA8h8FmZD071fbF2TRXX5+r28rdThqKdlJg6oHk5ahgZc2mHolju26wfjJ1p1S2HcCqjJrg1nw0YmE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559039709903225.18712833871803; Tue, 28 May 2019 03:35:09 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVZQz-0006Ye-GW; Tue, 28 May 2019 10:34:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVZQF-0004vF-HN for xen-devel@lists.xenproject.org; Tue, 28 May 2019 10:33:35 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 08188bae-8134-11e9-a561-2b85f6796d62; Tue, 28 May 2019 10:33:29 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 567DCB06B; Tue, 28 May 2019 10:33:28 +0000 (UTC) X-Inumbo-ID: 08188bae-8134-11e9-a561-2b85f6796d62 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 28 May 2019 12:32:59 +0200 Message-Id: <20190528103313.1343-47-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190528103313.1343-1-jgross@suse.com> References: <20190528103313.1343-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 46/60] xen/sched: carve out freeing sched_unit memory into dedicated function X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , George Dunlap , Dario Faggioli MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" We'll need a way to free a sched_unit structure without side effects in a later patch. Signed-off-by: Juergen Gross --- RFC V2: new patch, carved out from RFC V1 patch 49 --- xen/common/schedule.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index e189cc7c2b..9bff4dc183 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -288,26 +288,10 @@ static void sched_spin_unlock_double(spinlock_t *lock= 1, spinlock_t *lock2, spin_unlock_irqrestore(lock1, flags); } =20 -static void sched_free_unit(struct sched_unit *unit, struct vcpu *v) +static void sched_free_unit_mem(struct sched_unit *unit) { struct sched_unit *prev_unit; struct domain *d =3D unit->domain; - struct vcpu *vunit; - unsigned int cnt =3D 0; - - /* Don't count to be released vcpu, might be not in vcpu list yet. */ - for_each_sched_unit_vcpu ( unit, vunit ) - if ( vunit !=3D v ) - cnt++; - - v->sched_unit =3D NULL; - unit->runstate_cnt[v->runstate.state]--; - - if ( cnt ) - return; - - if ( unit->vcpu =3D=3D v ) - unit->vcpu =3D v->next_in_list; =20 if ( d->sched_unit_list =3D=3D unit ) d->sched_unit_list =3D unit->next_in_list; @@ -331,6 +315,26 @@ static void sched_free_unit(struct sched_unit *unit, s= truct vcpu *v) xfree(unit); } =20 +static void sched_free_unit(struct sched_unit *unit, struct vcpu *v) +{ + struct vcpu *vunit; + unsigned int cnt =3D 0; + + /* Don't count to be released vcpu, might be not in vcpu list yet. */ + for_each_sched_unit_vcpu ( unit, vunit ) + if ( vunit !=3D v ) + cnt++; + + v->sched_unit =3D NULL; + unit->runstate_cnt[v->runstate.state]--; + + if ( unit->vcpu =3D=3D v ) + unit->vcpu =3D v->next_in_list; + + if ( !cnt ) + sched_free_unit_mem(unit); +} + static void sched_unit_add_vcpu(struct sched_unit *unit, struct vcpu *v) { v->sched_unit =3D unit; --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel