From nobody Sat May 4 00:45:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1585242572; cv=none; d=zohomail.com; s=zohoarc; b=Ygnj2sg1HfHGHr9XBuoFw8tpm0bpWO9fSCmtBhy94PBgz3sHKtCXCrjVNl6Y3VQ6fqoiOCfN7fTP2wuHlE4XHNbtB4BvoE7tZppSKR2P//HyndjKTrbvbEij9ccXd3BIhhqsZFfhbs1zbHYPLswgdyoI2LpOxeptnkQZh0DUBhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585242572; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YSzrE5LOIs7CTi7Z/uVxNAEXZwpAPQozP9FOL27fHy0=; b=IXjHJj8Fj4Ehl/4Ela8iHKSjKqoULwtM92DpuVHYrg5x2ySfkEoPYV1qd2qroLVNTHQgLTJXcn9gr58GQbKAr2BRnrTzMgd3oBZ8jSaE8w94G0J0mZpK7diPmKKAyarWqMPCouilxM4I1Cuw+4Or+gg1UKXtFlafiVIfl9SzF00= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585242572046921.6142391976244; Thu, 26 Mar 2020 10:09:32 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHVzr-00089Z-HW; Thu, 26 Mar 2020 17:08:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHVzq-00089U-IZ for xen-devel@lists.xenproject.org; Thu, 26 Mar 2020 17:08:46 +0000 Received: from mail-wm1-f66.google.com (unknown [209.85.128.66]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 739b02b4-6f84-11ea-8823-12813bfff9fa; Thu, 26 Mar 2020 17:08:45 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id d198so7351036wmd.0 for ; Thu, 26 Mar 2020 10:08:45 -0700 (PDT) Received: from [192.168.0.35] (87.78.186.89.cust.ip.kpnqwest.it. [89.186.78.87]) by smtp.gmail.com with ESMTPSA id i1sm4334730wrq.89.2020.03.26.10.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 10:08:44 -0700 (PDT) X-Inumbo-ID: 739b02b4-6f84-11ea-8823-12813bfff9fa X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=YSzrE5LOIs7CTi7Z/uVxNAEXZwpAPQozP9FOL27fHy0=; b=ml/eaDyZYaFVKynx1Pa2jh3zukIwdtneIwkQ/w3hGeIRIBJv8AFzTiV3okKpbyJAOx 7yh+1nQw5U8R0KNyvjvL5/5BTrKlOTXBNQrU4baFND7PNGsMOV/dMkavwMWmdwEq89Bl iwW3gtkNN0GXv/cVwLbkCYHeUzwI+jwh+HgYnYeOqIZKTZZtl0RYbQfTrEiWyRaeu+b7 VeYPXBNAfG3D7FTnXLJn5oLUkbYl0iH5a4/uY7VQ3dz5mLS3yfafBwSNuDgy3HFCBnbf 4hyuH8daPWSlAT5auxMVaLUU13uCRySwzts8VMCXKIzeOLYSZ8FZqZPlqRWCfbdrPAFH lDlw== X-Gm-Message-State: ANhLgQ36qqsOVqAiuXn3v+WtjjwjYB0KSL35R242ihKZi5ne1gfH6PjN DbFyeH5DaoLlHbZ5SEgVmgc= X-Google-Smtp-Source: ADFU+vv9pvJo6+deAZEFwxoLwBEvRXl+WGGo0Kh1GSaI+gDjT8czUaz4bl8cM00y3m65nNb0GVMDBw== X-Received: by 2002:a1c:b4d4:: with SMTP id d203mr919075wmf.85.1585242524925; Thu, 26 Mar 2020 10:08:44 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 26 Mar 2020 18:08:43 +0100 Message-ID: <158524252335.30595.3422322089286433323.stgit@Palanthas> User-Agent: StGit/0.21 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Xen-devel] [PATCH] xen: credit2: document that min_rqd is valid and ok to use X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?J=C3=BCrgen?= =?utf-8?b?R3Jvw58=?= , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Code is a bit involved, and it is not easy to tell that min_rqd, inside csched2_res_pick() is actually pointing to a runqueue, when it is dereferenced. Add a comment and an ASSERT() for that. Suggested-by: Jan Beulich Signed-off-by: Dario Faggioli --- Cc: J=C3=BCrgen Gro=C3=9F --- xen/common/sched/credit2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index c7241944a8..9da51e624b 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -2387,6 +2387,13 @@ csched2_res_pick(const struct scheduler *ops, const = struct sched_unit *unit) goto out_up; } =20 + /* + * If we're here, min_rqd must be valid. In fact, either we picked a + * runqueue in the "list_for_each" (as min_avgload is initialized to + * MAX_LOAD) or we just did that (in the "else" branch) above. + */ + ASSERT(min_rqd); + new_cpu =3D cpumask_cycle(min_rqd->pick_bias, cpumask_scratch_cpu(cpu)= ); min_rqd->pick_bias =3D new_cpu; BUG_ON(new_cpu >=3D nr_cpu_ids);