Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162309AbbKEQ3f (ORCPT ); Thu, 5 Nov 2015 11:29:35 -0500 Received: from g2t4619.austin.hp.com ([15.73.212.82]:55167 "EHLO g2t4619.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161973AbbKEQ3c (ORCPT ); Thu, 5 Nov 2015 11:29:32 -0500 Message-ID: <563B83E9.60909@hpe.com> Date: Thu, 05 Nov 2015 11:29:29 -0500 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch , Davidlohr Bueso Subject: Re: [PATCH tip/locking/core v9 4/6] locking/pvqspinlock: Collect slowpath lock statistics References: <1446247597-61863-1-git-send-email-Waiman.Long@hpe.com> <1446247597-61863-5-git-send-email-Waiman.Long@hpe.com> <20151102164040.GV3604@twins.programming.kicks-ass.net> In-Reply-To: <20151102164040.GV3604@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2220 Lines: 58 On 11/02/2015 11:40 AM, Peter Zijlstra wrote: > On Fri, Oct 30, 2015 at 07:26:35PM -0400, Waiman Long wrote: >> This patch enables the accumulation of kicking and waiting related >> PV qspinlock statistics when the new QUEUED_LOCK_STAT configuration >> option is selected. It also enables the collection of data which >> enable us to calculate the kicking and wakeup latencies which have >> a heavy dependency on the CPUs being used. >> >> The statistical counters are per-cpu variables to minimize the >> performance overhead in their updates. These counters are exported >> via the sysfs filesystem under the /sys/kernel/qlockstat directory. >> When the corresponding sysfs files are read, summation and computing >> of the required data are then performed. > Why did you switch to sysfs? You can create custom debugfs files too. I was not aware of that capability. So you mean using debugfs_create_file() using custom file_operations. Right? That doesn't seem to be easier than using sysfs. However, I can use that if you think it is better to use debugfs. > >> @@ -259,7 +275,7 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node) >> if (READ_ONCE(pn->state) == vcpu_hashed) >> lp = (struct qspinlock **)1; >> >> - for (;;) { >> + for (;; waitcnt++) { >> for (loop = SPIN_THRESHOLD; loop; loop--) { >> if (!READ_ONCE(l->locked)) >> return; > Did you check that goes away when !STAT ? Yes, the increment code goes away when !STAT. I had added a comment to talk about that. > >> +/* >> + * Return the average kick latency (ns) = pv_latency_kick/pv_kick_unlock >> + */ >> +static ssize_t >> +kick_latency_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) >> +{ >> + int cpu; >> + u64 latencies = 0, kicks = 0; >> + >> + for_each_online_cpu(cpu) { > I think you need for_each_possible_cpu(), otherwise the results will > change with hotplug operations. Right, I will make the change. Cheers, Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/