From patchwork Thu Feb 9 13:58:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9564629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E466601C3 for ; Thu, 9 Feb 2017 14:01:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5B128499 for ; Thu, 9 Feb 2017 14:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F4BF284D1; Thu, 9 Feb 2017 14:01:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34F7528499 for ; Thu, 9 Feb 2017 14:01:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbpF6-0003rk-Kd; Thu, 09 Feb 2017 13:58:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbpF5-0003re-4e for xen-devel@lists.xenproject.org; Thu, 09 Feb 2017 13:58:35 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 07/05-05166-A857C985; Thu, 09 Feb 2017 13:58:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRWlGSWpSXmKPExsXiVRvkqNtZOif C4OFqTYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPWxreMBYe4Ko4332RvYNzD0cXIySEkMJ1R 4uYmzS5GLg4WgTWsElO2XWMHSUgIXGKVeLe9EMKOkVi8/ycLhF0lseLPYjaIZhWJm9tXMYE0C wn8ZpTY+O44M0hCWEBP4sjRH+wQdoTEvsdTwZrZBAwk3uzYywpiiwgoSdxbNRmomYODWUBfYv VXHpAwi4CqxKO738BKeAU8JZ7/vQU2klPAW+L9vbXsEHu9JJb9XQo2UlRATmLl5RaoekGJkzO fsECM1JRYv0sfJMwsIC+x/e0c5gmMIrOQVM1CqJqFpGoBI/MqRvXi1KKy1CJdC72kosz0jJLc xMwcXUMDU73c1OLixPTUnMSkYr3k/NxNjMDAZwCCHYwHm50PMUpyMCmJ8soWzIkQ4kvKT6nMS CzOiC8qzUktPsSowcEhMOHs3OlMUix5+XmpShK8H0uA6gSLUtNTK9Iyc4CxCVMqwcGjJMJ7FS TNW1yQmFucmQ6ROsWoy7Fr1+WXTEJgM6TEeatAigRAijJK8+BGwNLEJUZZKWFeRqADhXgKUot yM0tQ5V8xinMwKgnzPgeZwpOZVwK36RXQEUxAR1w/PQvkiJJEhJRUA2NV9Ycc3u7IWzOfy02J SZnZtSd37Y2zXCa3zcImHl4rVLts/pJD60rrn13dty3wefrdn4Yseyy5bt/om3lMeU358Rcq5 eriE1VvTtaqcHFW2Sj0y+9xcUzUBYGjG0NdHB5LJJ3Zd2CpvNi9eV9kc/tc/dYpp5ef6d74x7 z+zO6y4yJm9v81uzcrsRRnJBpqMRcVJwIAJm9sXQ4DAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1486648713!83955637!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12901 invoked from network); 9 Feb 2017 13:58:33 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 9 Feb 2017 13:58:33 -0000 Received: by mail-wm0-f65.google.com with SMTP id v77so3007436wmv.0 for ; Thu, 09 Feb 2017 05:58:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=GmhyLLj2VEp+zMITkTOxXJGPqVksiwtsiUKZ/Bf0/7g=; b=WjQ9HBF5Q6/OOYZ/WRjPHSVCPpkjz5JGVb1/TZmP2A6cfpZwRG5ZPwcd5pyVJxaebX kpIGgKmq0ZvbImSsnhVJORDB121LlnLIuDy1dh5TWi3Q2y6+p1O7466wNnjHNflbaBtV vHkfM0BrtobE41prUN7aa8I0l4/KCVASacyxKgEclrKQwq+80qdNEmenCE2EIs2VppxM VCOXjqsNegigOc1tQHoDjRvOd49QXHxNF5IAiDlL1loPh93z2IIny2k0DEaevAXzun8p lDWPD8yzHKHbKQcrJXt7qW1e3yFyCCLJ1/VV1KGrqLNeDnwp8vNM9cVca1//wyYeVTD4 u56A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=GmhyLLj2VEp+zMITkTOxXJGPqVksiwtsiUKZ/Bf0/7g=; b=J7KBaXUb4vVyhtGFTGqfouXERaFPHWbZdLWWxD7hZrR5w/l0g3adTHlK8eCBg5JKx4 cmFDzCGFsdND+2Xep5ZV5TD1ZbrPxS72UgbnCb+KMPerLef/jIx8C0BQ61QaYxnrks8j jLC0TitngwMD+kHkEpcqOpiIDzu7Zh3qX6VrZQsdTIhdEbGIDwcqaLFmrTsycRMIhtwg 9Sv6OCaDAJF2EXkHpwfSPeWlTrN9vtDeShiOBZxyaSkcBXDGC2p0M/vKBYMWdApQ4u6B 0xt4UTYM9CygGeRbsZqPIyw3Jkmwd456Z/TdFzCDOOxrZSZBZ+Y0oY8i4fwFy+G+RueR PUDQ== X-Gm-Message-State: AMke39lQWUxQNNeZzvEvm3yMQqlZxNS6qL645YD1tb5ynkUylsptXye8nGaopAZHk7TvTg== X-Received: by 10.28.109.70 with SMTP id i67mr21486463wmc.102.1486648713309; Thu, 09 Feb 2017 05:58:33 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.139]) by smtp.gmail.com with ESMTPSA id x135sm9005217wme.23.2017.02.09.05.58.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 05:58:32 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 09 Feb 2017 14:58:31 +0100 Message-ID: <148664871144.595.6494279719176911101.stgit@Solace.fritz.box> In-Reply-To: <148664844741.595.10506268024432565895.stgit@Solace.fritz.box> References: <148664844741.595.10506268024432565895.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v2 02/10] xen: credit2: clear bit instead of skip step in runq_tickle() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since we are doing cpumask manipulation already, clear a bit in the mask at once. Doing that will save us an if, later in the code. No functional change intended. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap --- Changes from v1: * rebased on current staging. --- xen/common/sched_credit2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 741d372..920a7ce 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -991,7 +991,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) cpumask_andnot(&mask, &rqd->active, &rqd->idle); cpumask_andnot(&mask, &mask, &rqd->tickled); cpumask_and(&mask, &mask, cpumask_scratch_cpu(cpu)); - if ( cpumask_test_cpu(cpu, &mask) ) + if ( __cpumask_test_and_clear_cpu(cpu, &mask) ) { cur = CSCHED2_VCPU(curr_on_cpu(cpu)); burn_credits(rqd, cur, now); @@ -1007,8 +1007,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) for_each_cpu(i, &mask) { /* Already looked at this one above */ - if ( i == cpu ) - continue; + ASSERT(i != cpu); cur = CSCHED2_VCPU(curr_on_cpu(i));