From: Andrew Cooper Subject: [PATCH 2/4] xen/evtchn: Reduce the size of the poll_mask where possible Date: Mon, 19 Jan 2015 11:21:34 +0000 Message-ID: <1421666496-10676-3-git-send-email-andrew.cooper3@citrix.com> References: <1421666496-10676-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1421666496-10676-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Keir Fraser , Ian Campbell , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich List-Id: xen-devel@lists.xenproject.org Use domain_max_vcpus(d) in preference to MAX_VIRT_CPUS when allocating the poll mask. This allows x86 HVM guests to have a poll mask of 128 bits rather than 8k bits. While changing this, use xzalloc_array() in preference to xmalloc_array() to avoid needing the subsequent call to bitmap_zero(). Signed-off-by: Andrew Cooper CC: Keir Fraser CC: Jan Beulich CC: Tim Deegan CC: Ian Campbell CC: Ian Jackson --- xen/common/event_channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 7d6de54..1c15569 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -1269,13 +1269,13 @@ int evtchn_init(struct domain *d) evtchn_from_port(d, 0)->state = ECS_RESERVED; #if MAX_VIRT_CPUS > BITS_PER_LONG - d->poll_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(MAX_VIRT_CPUS)); + d->poll_mask = xzalloc_array( + unsigned long, BITS_TO_LONGS(domain_max_vcpus(d))); if ( !d->poll_mask ) { free_evtchn_bucket(d, d->evtchn); return -ENOMEM; } - bitmap_zero(d->poll_mask, MAX_VIRT_CPUS); #endif return 0; -- 1.7.10.4