From patchwork Fri Jun 23 10:55:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9806253 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 D968460329 for ; Fri, 23 Jun 2017 10:57:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA821285EE for ; Fri, 23 Jun 2017 10:57:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF6D328616; Fri, 23 Jun 2017 10:57:20 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 595BC285EE for ; Fri, 23 Jun 2017 10:57:20 +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 1dOMF5-0006Hm-2y; Fri, 23 Jun 2017 10:55:11 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOMF3-0006H9-Ef for xen-devel@lists.xenproject.org; Fri, 23 Jun 2017 10:55:09 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 90/C0-03058-C83FC495; Fri, 23 Jun 2017 10:55:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleJIrShJLcpLzFFi42K5GNpwWLfns0+ kwavHAhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a7xvCCRVIV6z8+ZGxg3CfSxcjFISQwk1Gi 59xPFhCHRWANq8SPvy+ZQBwJgUusErPfdwE5nEBOnMTDM4tZIexqieO7WsBsIQEViZvbVzFBj PoONOrzDzaQhLCAnsSRoz/YIWxPiVufXoINYhMwkHizYy9Ys4iAksS9VZPB4swCoRJz3p0B62 URUJW4tGM/mM0r4Chx9uJBsHpOASeJCat2MkEsdpRo+f+CGcQWFZCTWHkZ4iBeAUGJkzOfAL3 DATRTU2L9Ln2I8fIS29/OYZ7AKDILSdUshKpZSKoWMDKvYtQoTi0qSy3SNTbSSyrKTM8oyU3M zNE1NDDTy00tLk5MT81JTCrWS87P3cQIDH8GINjBeHpd4CFGSQ4mJVHe2DM+kUJ8SfkplRmJx RnxRaU5qcWHGDU4OAQmnJ07nUmKJS8/L1VJgvf3R6A6waLU9NSKtMwcYITClEpw8CiJ8G7/AJ TmLS5IzC3OTIdInWI05rhyZd0XJo4pB7Z/YRICmyQlzvsUZJIASGlGaR7cIFjiuMQoKyXMywh 0phBPQWpRbmYJqvwrRnEORiVh3uJPQFN4MvNK4Pa9AjqFCeiUGWvATilJREhJNTDqrJzeeuLH 3enqN3t+dJ8Mecu/yOUu28cXay7wtT5eKvZtLntfqPnP+4sSnu05f0yV61H/jXw7360iT/kXn o9tP+pwa8ltP+6MNaK8EmU/NMR710fGNUvc/WEZUH4rUTue6Vs44xr9+QfYNc9FvbllM/lXCN uPl9v8ZW+ce6QXnhjl9G2R37oCJZbijERDLeai4kQAg0r4LhcDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1498215308!75234970!1 X-Originating-IP: [209.85.128.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22548 invoked from network); 23 Jun 2017 10:55:08 -0000 Received: from mail-wr0-f195.google.com (HELO mail-wr0-f195.google.com) (209.85.128.195) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Jun 2017 10:55:08 -0000 Received: by mail-wr0-f195.google.com with SMTP id x23so11635995wrb.0 for ; Fri, 23 Jun 2017 03:55:08 -0700 (PDT) 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=4Ys+OA7xR9d1dq/uAcbkgvgwSafEguPgW67iOowrUpw=; b=TkCS7uQxdkJn9cz310+GtRpo9H6PtYIMobZPgiR0+khbLZ3VV/x3cgbvnyRg/Q892d PN4VIDdr1hOzmNy2Yu/eyOfmdz5xDN/9rCr7G3PpLhdXVoMTsaZz87SMaygDVI/c2ji2 +/07XU9yVoXOegs/PYmyoOXZ1Qx4b4jP0CtQfkL+o3IPMd6zriQXYbCO9+r6ccH2o+tV tGJUCJ2vbWIqyatZZAigGp4SgZjJLJnZAs8YMOZOMB2fzVuzyDTP8/Sm/C6ahHaiLfMc eUVCyr/iE1NQ8vtyMpqHydsFKG3Q4DdRTX6tlIth9F9CyyU50wXsd0e5hXq/iVg4UFah 88Pw== 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=4Ys+OA7xR9d1dq/uAcbkgvgwSafEguPgW67iOowrUpw=; b=NspnQ3x7In5bhKDLqoFR58fOtMiSNnUIk3eBoCq76/lBpW63j2ZFVPDP/e4eXahcsV T7klVH34SLwyK5B/CdzUKf39axyTBQFSB4lAlvCEW7Y1w3PDKZNzKsZr+m1iolkCZQtC bBy20TNaSGbNrVgla1T8B7jLJgYNppMNAMQ1UaZZK0XMGgD2hm66h1A7hG5pihm7e0Jr dTMrO4L4xP8yEIYPg6oGMif3iA1ZbfS17YfMfLxseHV8f+ma28qUJZoE9FlKI2CT2zDU yHzooLbkZR/JDBh5xjrLmlouZStgGcQSeovVz7Rxn0RlAJdEKGHo1SzWAHFwU6R3712m aOuw== X-Gm-Message-State: AKS2vOy/dsVLLGwMg3/ESaLlRVTlwpMIl8Ew3hTq4Geck81l7/b/8bzG DL3cYM3O5RA7P3Mv X-Received: by 10.223.182.172 with SMTP id j44mr1327533wre.122.1498215307611; Fri, 23 Jun 2017 03:55:07 -0700 (PDT) Received: from [192.168.0.31] ([80.66.223.81]) by smtp.gmail.com with ESMTPSA id l20sm3150399wre.25.2017.06.23.03.55.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jun 2017 03:55:07 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 23 Jun 2017 12:55:05 +0200 Message-ID: <149821530581.5914.13068641070748575404.stgit@Solace> In-Reply-To: <149821475587.5914.12193327340105859241.stgit@Solace> References: <149821475587.5914.12193327340105859241.stgit@Solace> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Anshul Makkar Subject: [Xen-devel] [PATCH 3/6] xen: credit: rearrange members of control structures 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 With the aim of improving memory size and layout, and at the same time trying to put related fields reside in the same cacheline. Here's a summary of the output of `pahole`, with and without this patch, for the affected data structures. csched_pcpu: * Before: size: 88, cachelines: 2, members: 6 sum members: 80, holes: 1, sum holes: 4 padding: 4 paddings: 1, sum paddings: 5 last cacheline: 24 bytes * After: size: 80, cachelines: 2, members: 6 paddings: 1, sum paddings: 5 last cacheline: 16 bytes csched_vcpu: * Before: size: 72, cachelines: 2, members: 9 padding: 2 last cacheline: 8 bytes * After: same numbers, but move some fields to put related fields in same cache line. csched_private: * Before: size: 152, cachelines: 3, members: 17 sum members: 140, holes: 2, sum holes: 8 padding: 4 paddings: 1, sum paddings: 5 last cacheline: 24 bytes * After: same numbers, but move some fields to put related fields in same cache line. Signed-off-by: Dario Faggioli Acked-by: George Dunlap --- Cc: George Dunlap Cc: Anshul Makkar --- xen/common/sched_credit.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index efdf6bf..4f6330e 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -169,10 +169,12 @@ integer_param("sched_credit_tslice_ms", sched_credit_tslice_ms); struct csched_pcpu { struct list_head runq; uint32_t runq_sort_last; - struct timer ticker; - unsigned int tick; + unsigned int idle_bias; unsigned int nr_runnable; + + unsigned int tick; + struct timer ticker; }; /* @@ -181,13 +183,18 @@ struct csched_pcpu { struct csched_vcpu { struct list_head runq_elem; struct list_head active_vcpu_elem; + + /* Up-pointers */ struct csched_dom *sdom; struct vcpu *vcpu; - atomic_t credit; - unsigned int residual; + s_time_t start_time; /* When we were scheduled (used for credit) */ unsigned flags; - int16_t pri; + int pri; + + atomic_t credit; + unsigned int residual; + #ifdef CSCHED_STATS struct { int credit_last; @@ -219,21 +226,25 @@ struct csched_dom { struct csched_private { /* lock for the whole pluggable scheduler, nests inside cpupool_lock */ spinlock_t lock; - struct list_head active_sdom; - uint32_t ncpus; - struct timer master_ticker; - unsigned int master; + cpumask_var_t idlers; cpumask_var_t cpus; + uint32_t *balance_bias; + uint32_t runq_sort; + unsigned int ratelimit_us; + + /* Period of master and tick in milliseconds */ + unsigned int tslice_ms, tick_period_us, ticks_per_tslice; + uint32_t ncpus; + + struct list_head active_sdom; uint32_t weight; uint32_t credit; int credit_balance; - uint32_t runq_sort; - uint32_t *balance_bias; - unsigned ratelimit_us; - /* Period of master and tick in milliseconds */ - unsigned tslice_ms, tick_period_us, ticks_per_tslice; - unsigned credits_per_tslice; + unsigned int credits_per_tslice; + + unsigned int master; + struct timer master_ticker; }; static void csched_tick(void *_cpu);