From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dietmar Hahn Subject: Re: [PATCH v12 for-xen-4.5 11/20] x86/VPMU: Interface for setting PMU mode and flags Date: Mon, 29 Sep 2014 16:03:28 +0200 Message-ID: <1911574.6mNKem7nsj@amur> References: <1411673336-32736-1-git-send-email-boris.ostrovsky@oracle.com> <2307302.U8WBSjsMcB@amur> <54296522.7060001@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54296522.7060001@oracle.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@lists.xen.org Cc: kevin.tian@intel.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, tim@xen.org, Aravind.Gopalakrishnan@amd.com, jun.nakajima@intel.com, dgdegra@tycho.nsa.gov, Boris Ostrovsky , suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org Am Montag 29 September 2014, 09:56:50 schrieb Boris Ostrovsky: > On 09/29/2014 09:25 AM, Dietmar Hahn wrote: > > +static int vpmu_force_context_switch(void) > > +{ > > + unsigned i, j, allbutself_num, mycpu; > > + static s_time_t start, now; > > + struct tasklet **sync_task; > > + struct vcpu *curr_vcpu = current; > > + int ret = 0; > > + > > + allbutself_num = num_online_cpus() - 1; > > + > > + sync_task = xzalloc_array(struct tasklet *, allbutself_num); > > + if ( !sync_task ) > > + { > > + printk(XENLOG_WARNING "vpmu_force_context_switch: out of memory\n"); > > + return -ENOMEM; > > + } > > + > > + for ( i = 0; i < allbutself_num; i++ ) > > + { > > + sync_task[i] = xmalloc(struct tasklet); > > + if ( sync_task[i] == NULL ) > > + { > > + printk(XENLOG_WARNING "vpmu_force_context_switch: out of memory\n"); > > + ret = -ENOMEM; > > + goto out; > > + } > > + tasklet_init(sync_task[i], vpmu_sched_checkin, 0); > > Only a question of understanding. > > Is there a special reason not to use a single memory allocation > > except for memory fragmentation on systems with a large number of cpus? > > > > struct tasklet *sync_task; > > sync_task = xmalloc(sizeof(struct tasklet) * allbutself_num); > > > Exactly because of fragmentation -- this will avoid asking for more than > a page during runtime. I, in fact, originally had it allocated as a > single chunk, just as you suggested above, but Jan asked this to be > split into smaller, sub-page pieces. > > -boris OK, then I overlooked this :-( Sorry for the noise! Dietmar. > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > -- Company details: http://ts.fujitsu.com/imprint.html