From patchwork Fri Feb 16 18:30:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp706662dyb; Fri, 16 Feb 2024 10:32:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXrYofQgKPLq2NNaiePaRUtQaarjHEBnItDkzQm7djCVCKnvZ2amETNAOY4PnyASPmwrQ97LWefRGIOlxWTicAyvAwSZg== X-Google-Smtp-Source: AGHT+IG3LbluJKpEgdlRlAecQb8ZpByLcnlHD+qPgLXsP+Ns/qmgqTFQ9ooqEuzaWPer2HVAMtXb X-Received: by 2002:a05:6a00:1750:b0:6de:1d04:c600 with SMTP id j16-20020a056a00175000b006de1d04c600mr4952880pfc.34.1708108331688; Fri, 16 Feb 2024 10:32:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108331; cv=pass; d=google.com; s=arc-20160816; b=CbsG4c/nbfCBNZYMkETTvcsAnShcYOOkT+O4ywzZ58G1qX2KLpRw+E6KsXgPkestru FWRxtLRHtxxlMzulrlUwlis+EKdXz3S1PxVF4HRYtcfUZuI/4BfXkmoqmgB0ieedH1G3 p54h0uqsDEUfiXpSiRL+8ILvvyTpjJrFPE/bezPpvITsbZthuZMEjeI8TQYp8oL50xjj QDl7eik6i5tsCLjjg1P1j0Du4pmxXP3fI9P3Uw620VH9SRY1ZtXZT//jMFlOCpK5tKl+ 5r1hmEnxghpoNnG84s8mU/mRcyWotVOQzHgZMFuzGs4VUP5iGDGdFDq/4AJO+O9Gbs2h jqLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dVFjYg00n2ZAFDWX2JpqdHNuxugRyfOJfGbuxjDxV/Q=; fh=M2d0eEwkotGwrCl/QH/u/fnmeLJn9ZwWPiMveRgwy+8=; b=blsxu6vLNy6iu9syuR3fvBGzfrR8PoyP/2oH25DNCGBishPMcNiY3GiOetO5i0tLzB 0nF8OrFRDVvpF6HX/dxCZ80jV2AHuTwKaIUEbRYAM4teTCrhpX5IdJXDesXhb6l0CNjd xmhD9TAA5XCprduorNoi2D6gV1pz5snppq5URCdgbBoAQUEOH/YNpjEwFzeTEWc7oiUI 32yElsCmFkzJfWOd2mRpiFlaC+httU9UvqxaL2SJSBsXeDSR5IfjNokiaLqtkGorJwlD pIOpDTa/kYzshuQllD5A1Bm57gpeCosf4nB3l1fTM8Gm3aqFzHU80tSb4CV1CUjZro7d B1sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=jtG1w6j9; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69160-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69160-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q21-20020a638c55000000b005d8b313de26si241991pgn.594.2024.02.16.10.32.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:32:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69160-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=jtG1w6j9; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69160-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69160-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7440F281408 for ; Fri, 16 Feb 2024 18:32:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E88271353EC; Fri, 16 Feb 2024 18:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="jtG1w6j9" Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD40C12FB18 for ; Fri, 16 Feb 2024 18:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108302; cv=none; b=CRRa83AkzCXeZS4TB5Hze0hoWJVsVrSAJ6T/lZfXjw0cqip3NWj0c2KZjph8RJg76GWrHjoB8ewNRvKDJOmyXTYrHVNyBWnXaFl0wL2hzN8KwWAeJg8V7W76mAyjSJBfq0HK0hEsDbO2FLuoUqJ7ml43EmtkkWKJJREWBngF0Ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108302; c=relaxed/simple; bh=/tum2WF4xPzP3d2/oUJvAp904N/cyC9DIis13Mprwms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HhhFfbGXCyGXvimt2OaVALuE1Bisilw0lodYH5/8x45glyZpKAanQ9ttBmUXYJOxg1U0Y9D2GRB+g2Hfctcv+rkH1pk49p3DTAdH78gES1whLOFy5UxA/dnZKCNngQUsAGHSGGOxtaVUxYOOwLQROP4gh6C52FbuJx4W9fqqftk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=jtG1w6j9; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-59a94c0fb55so1148342eaf.0 for ; Fri, 16 Feb 2024 10:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108298; x=1708713098; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dVFjYg00n2ZAFDWX2JpqdHNuxugRyfOJfGbuxjDxV/Q=; b=jtG1w6j9N5plCISXLHBSv/uwTyCu7EH8Sx8Ee3zv11t6ywmECZSmwpY0oybC7bZ5vs 3HQnp+vpaNyOiNVApl+5btIdCgtlyPizk07ugC55D8sOSb7Fu+M2dweor+2Qxok7q7wD owi1guotqKnwmb0LsKmonexOPeI+yra9+hN+4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108298; x=1708713098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dVFjYg00n2ZAFDWX2JpqdHNuxugRyfOJfGbuxjDxV/Q=; b=vzAEpyDBZ1jmtWKlJ7/pYt9oDhRAEMB7wuJLmC+sgWzG5F6S4UlWp0w6tz3Cdb/MvJ zzC6LzNZOannRnVLbLLA5X69gZFOms3Js0jIl0/xmzA3tGi7izNwQ2x/DwxUIn9Kc/AV j8lENOACWC45iAg/i1R/Dm4GoBj6g4HjA1j3ZX0xS5pa8Cp8e8dKwjerT7yVfK/nndEB aQlHibMQ06LPsUwcH0C1PYYVBHBKuNq6QD4RGLdU1lCDTYkN3tz5iHLFeAWx7BJTdDGq w4I2zIRbzpqaYLT30z2OJMHCSkGJ8x/7E4f34tKqB5Bmilscc0OlUfwLTWCzXCfnG2hq E50g== X-Gm-Message-State: AOJu0Yw8UfvwLET/uoBhZgMTxhWg/NrzQXSXgPzzwLGWFThEn/JqrCL7 2nsuVvfukAvvDJ3v3clV0sT5vIve9H825i3rE3gjI/Hd2zUFWeydBIp+UyLkYlS64FS1+Ibt1wB 7 X-Received: by 2002:a05:6358:3384:b0:176:d46c:e704 with SMTP id i4-20020a056358338400b00176d46ce704mr6500262rwd.16.1708108298409; Fri, 16 Feb 2024 10:31:38 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:37 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" Subject: [PATCH 01/10] sched/core: Add clearing of ->dl_server in put_prev_task_balance() Date: Fri, 16 Feb 2024 13:30:59 -0500 Message-Id: <20240216183108.1564958-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081402038234658 X-GMAIL-MSGID: 1791081402038234658 Paths using put_prev_task_balance() need to do a pick shortly after. Make sure they also clear the ->dl_server on prev as a part of that. Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 973fd610d089..7f3a2596c1ed 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5998,6 +5998,14 @@ static void put_prev_task_balance(struct rq *rq, struct task_struct *prev, #endif put_prev_task(rq, prev); + + /* + * We've updated @prev and no longer need the server link, clear it. + * Must be done before ->pick_next_task() because that can (re)set + * ->dl_server. + */ + if (prev->dl_server) + prev->dl_server = NULL; } /* @@ -6041,14 +6049,6 @@ __pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) restart: put_prev_task_balance(rq, prev, rf); - /* - * We've updated @prev and no longer need the server link, clear it. - * Must be done before ->pick_next_task() because that can (re)set - * ->dl_server. - */ - if (prev->dl_server) - prev->dl_server = NULL; - for_each_class(class) { p = class->pick_next_task(rq); if (p) From patchwork Fri Feb 16 18:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp712419dyb; Fri, 16 Feb 2024 10:42:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUCvSIneRmBIOD/5sLnBafSmbbf6tvWpj+fV70exQE8EbTqtTdVwkUrNJrjeVHRWIs1eB2WrDkt5QU7EiNVh2q0IVZ2lA== X-Google-Smtp-Source: AGHT+IFS0U0DvbOGFrvfS1jhlnea32XV3BeFpvCprfOFSLO5kI7YdzvS/ITZfAn9/jXbHDVr4W4G X-Received: by 2002:a05:6a20:9f8c:b0:19c:b457:fb8 with SMTP id mm12-20020a056a209f8c00b0019cb4570fb8mr6222681pzb.51.1708108962623; Fri, 16 Feb 2024 10:42:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108962; cv=pass; d=google.com; s=arc-20160816; b=ty5kG52F/ppGTmylc+sXOuIhX+2qC64SHA1XTDn9LIHWbLv9YK4pju19Uz3J9gTFHF jR6lcZx9qDjraR9IUo7v0WuGZOi5sdPbwn5YEOgkb6F3E6Gt22VpaXAqkUMS+Yh0BJyk /7XhYYXgIhbVddgsFyr4NZ41uZFXnaP6fFTemTOJHwB6kiE7slnvb6CrLSTa09R7cXA7 UI4L240E3gR3t410GdduWdA6ZAGVk1vXl/sH9ZOmhttqnmUUBDdNnYJgpo/abFaDgJD0 E5Nu7VEHDsoH/HLNmPcIuutJc0iiZ3OOvxGrisJpn99ah1IwrVYpaGa/lM7ap00N+pkJ aj9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eIq/RsKJ+ZDmqaV4DNR53VSSNnL2VAVCUisag/qJ124=; fh=QKvmJ7gTQNDYX26cKmMd3Q4+uQjEbBu+6bD4aQXMqzg=; b=sIslLbQS5Ztw1CtDDF1D1vQYN8CRWoS2nCkaG82kixjxQMOhKiBVKF3kYDqhEr39n4 UJS745AL2ro+82J4ySMKm87gWd6rhZ99lMYR+M7GVba892SObWu8yicXDdaGlfVoeEhW hlz/Fq+BWTqjKhnw7t14hznx+k9gUtnjoklEuk9KQpC1C374E3udh6Z55Xs0giU4B/HJ KFHEmWyFiDKZUWKKU10M7WgNHWDL18D+brGjL40UUlLWimwsCRXC7A4drGiwIcxo7wty 4bc5eANCukGoP08vEgH4RcTUbAO0Sxqm6uICuFc1JC47hYfrGnCtXZ3lWgmq/Q2wzHTq wkGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=N0SEb23L; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69161-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69161-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a63-20020a639042000000b005dc816b234esi258851pge.629.2024.02.16.10.42.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69161-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=N0SEb23L; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69161-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69161-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 86008B2485A for ; Fri, 16 Feb 2024 18:32:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D12813540F; Fri, 16 Feb 2024 18:31:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="N0SEb23L" Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597E71350C8 for ; Fri, 16 Feb 2024 18:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108303; cv=none; b=JswvYlVhzzlhzzeghn4DjLQ+didPVce39SMJNgA4S2etN8ZgbWthI31G/SG5P4KkoJTlZg1P0lw+gXxCiNwJn693lOyR+6MX0P3Iv/6kPlViXruXDKFPHrBC/mCYUYcIQQDRZUUq6JVLfmCJrDU9MBV/sFLbBE1/SIsyRU4duNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108303; c=relaxed/simple; bh=ZOaTdU6+mkYKcu73jBNLA/JSAJmZHt+8O8zlVTj/AiM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CpNxZGtHhm6Z01k2ZmWFu5OhKd1lN4Cfip12lKbb3nfxvEKtFV1adZcZst3FZA3SM3IQLr5NcbJTdgs2cLWuT+0CXABamg9JKF2AxHnOCOzWQfFqdRTxsq8GjbPFI+x7jMAbJWnfu5HLPCkJUJP4Kq2H6Y/tYbKQefUClpQk0RU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=N0SEb23L; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c1333b0974so1781021b6e.1 for ; Fri, 16 Feb 2024 10:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108301; x=1708713101; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eIq/RsKJ+ZDmqaV4DNR53VSSNnL2VAVCUisag/qJ124=; b=N0SEb23LelsStLT58qIHRcuxwaRuV+ph907HfptgXBYsWzkKUUA6vLZG8d8B0yWkgD 50vde9a1DrDily4MklVo7zvFUooP3m70ZqxC/tcveowBwH0YLvGbP96Sb4qMBKpLI+UX mBq2Zlphj5vn0HoEQlREACIte4xStNScB9C9c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108301; x=1708713101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eIq/RsKJ+ZDmqaV4DNR53VSSNnL2VAVCUisag/qJ124=; b=PBBSwq+vQfosGrsp0HRW3qII/WfkiiKcAoR7Uepz8mBAvSfC0RcqNN9KgruzAFAPqO jF5YXZ+Cy++V56W0dDCEyBeaBwej9ecgmTFp75icBp96K3ROlra2UjGJuzQTDluAoGkQ j+gwvD8nGNzgsj0tYDhhks1giLvWJt9ktziyxDHIVCO3Eqr1wkaxaihlXdT1MVhyPvNR 7EJYJXy55KQJ1kIS+7yGjGpE2bvuuhgxu3ETx5r+XH/FRViUmu2oBeVd9tOmoqv4ENJb aGJUSugikkIXEtdw5XtxkzpJLRNyz1d42ggvFztosgAzKSplWlFKdO/37F2tOlDgqF1T TWsg== X-Gm-Message-State: AOJu0Yyq2opdH4xOkPpoQgjh+/3v5EvaXcB8xhyHa8G97gOcm2AdjswK b/NEw6KqN0BlFYEGhgQjzyPq/744eISPqa9Fi4+zFLZGEsYZr11dol7uDTJYWTAgrEI1WVFUluu 1 X-Received: by 2002:a05:6808:1642:b0:3c0:4d21:e62a with SMTP id az2-20020a056808164200b003c04d21e62amr6746614oib.31.1708108300676; Fri, 16 Feb 2024 10:31:40 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:39 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , Joel Fernandes Subject: [PATCH 02/10] sched/core: Clear prev->dl_server in CFS pick fast path Date: Fri, 16 Feb 2024 13:31:00 -0500 Message-Id: <20240216183108.1564958-3-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791082063399195732 X-GMAIL-MSGID: 1791082063399195732 From: Youssef Esmat In case the previous pick was a DL server pick, ->dl_server might be set. Clear it in the fast path as well. Signed-off-by: Youssef Esmat Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7f3a2596c1ed..63f41453b79e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6036,6 +6036,13 @@ __pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) p = pick_next_task_idle(rq); } + /* + * This is a normal CFS pick, but the previous could be a DL pick. + * Clear it as previous is no longer picked. + */ + if (prev->dl_server) + prev->dl_server = NULL; + /* * This is the fast path; it cannot be a DL server pick; * therefore even if @p == @prev, ->dl_server must be NULL. From patchwork Fri Feb 16 18:31:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp712702dyb; Fri, 16 Feb 2024 10:43:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXTabJwNn8JyXFR9x0Lc0EXxipXoWp2aECHvXsEm25XRQpLMO92otc2itJQqCZWm65VnaY951x7Bx6sJSsVyY23HNoiqQ== X-Google-Smtp-Source: AGHT+IHFL5PJA9BHHynDWY0XbQ0WdsGFj24cvEvMLFC8UhHQXO4qSfoC6vZWxImUboyd2OPCppvD X-Received: by 2002:a17:902:c1d5:b0:1db:c1f7:35ac with SMTP id c21-20020a170902c1d500b001dbc1f735acmr236699plc.45.1708108992969; Fri, 16 Feb 2024 10:43:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108992; cv=pass; d=google.com; s=arc-20160816; b=Nelt6df027+wG/bAtqle+lIyGYZKUmGt/FX1A8e6lTyPlf/WA10LayUOpvPx+4OAXy 7Q7/IFqFFSvwg5JYsh/5HtFh9o5p+3u6BkhsYrpvP650WhOXScQ+wFNmrjY+FSrMwZxD C7FthjRJ+3CYqBSg0VTUHFJZ7EGC56kxFJYqSKtrMPfbon1jMjco19N4wpxCe73RtqYD 6cok0+WdMTCtomgduJ0hTuQwViIZVcrbqKNWIasqels5T6kSpO4Tej0GPxslWmJQQ37E QBvtA6+TqnL98KutIs8uaPeal2p31U+BgN7lGLXaQly8CSOA4n1+FJmWxu4kEtUdCejr CfqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OS0mEpzEEFGetzR6NtkyoXN8TWiVnIyPmeWduyYdhXs=; fh=M2d0eEwkotGwrCl/QH/u/fnmeLJn9ZwWPiMveRgwy+8=; b=FOFv9WQsrs/M1Hz6r7KXafJydEYudRHgm3iLvDYzk9IlwrUlQ6q2oiM51PeaooJPCh D2fPBhj4pdPxwG6k2XZZBCMcmkPaEa4DfB8u2fU0yTYa1n2ogx8C10mGJoZjA9nteLYO ZEAqpoB7BFfXCtCIhD7OxBVrC7ehOj4h4x24WTZxu/SZ/ayXnWAHFZZta8qibMUPY8xr Fu8Q09R890oNPaTSVyLrQv5axr/I/saU6gXFvomJBRXxOYBfrr+s7LM6Zl4uPdWiilx/ qCpvNBnAgeFCVQzLsQUX8xYLlKXjPOd72y7pb2Nr1M8vd5LGQwf9Ki8gGf8xptxw8x9F 1+4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=affI+dTq; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69162-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k10-20020a170902d58a00b001db28c4b756si238738plh.269.2024.02.16.10.43.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:43:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=affI+dTq; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69162-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 15D09B252E8 for ; Fri, 16 Feb 2024 18:32:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1862913664A; Fri, 16 Feb 2024 18:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="affI+dTq" Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 924BE1353E5 for ; Fri, 16 Feb 2024 18:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108306; cv=none; b=kU62QZ2j6tKTqrOha/28zw58wx3S72sMhrKstVkXj9ghHz4A6GlD6ZU2mSb0hYvL68eFDhDsmzHi0iLTcNK3ph1ZAFIkLpWhDm8ETLOmi+GUuNhqlirjdCZs3W7xn/GsT33rS4O6jBTizfV9E/mwPQmiQUE/UgBGfk1/WqRT42c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108306; c=relaxed/simple; bh=BiiWEkX4I10hm0Y+ah7m6xE4dk8P54pifKn/ZYznW2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OiKIgvF8AxSI+vro7C02ozjVfpp4HVmklJLcM7hQDahj73lRON2rN15k5A6UmjNYD/E1sQspIeKx25xo7EPGdHZ0qyxD8AYDcQsef1vV0LBWyG5UEOieT/mjUbnApduVVlQnvwVac0akdjH4WYaYMTA42Exxh0r7BttH9KPKWiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=affI+dTq; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6818a9fe380so13862416d6.2 for ; Fri, 16 Feb 2024 10:31:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108303; x=1708713103; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OS0mEpzEEFGetzR6NtkyoXN8TWiVnIyPmeWduyYdhXs=; b=affI+dTqhOv2xxiSZ+dyvFmb9JgvjzInrIzZuv5+cVOuNMWSXyYCPrRBeu5iS4mj4c e3ZZi19gmrTb9jmmBE86fqdT6OByBU8C9BGmkOSvKzc8oYoqF7jQvVD2cClauReYKhqn 45LMMyZ5Og0zZl0zp7vEoRXaxykck4RXtdQdE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108303; x=1708713103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OS0mEpzEEFGetzR6NtkyoXN8TWiVnIyPmeWduyYdhXs=; b=diZ2AmVR7USHZIE+eyrDqc8V+zoHfghYKUqi8Ordkbri3mL0dIbEWf38Wi0bE8/E6R dRWlbaRoBF5MLq8xokYr3zEpI97SCMDsh0VQovECaYuaL2N5NxDnRdkcbKZex7kr7N8i biLLYirQmQOA0JdLPfxotrYSKJuJmcS3mZZx8WMnenvjkU9e7LoQqBMpzR60YdMxLFGk qGqccW7Np0X3pJ/5gubNYwkYsqU+9DPDUp4iwfiYeruL0E5uL1L5aeM1Pjx6reWi4yO6 qVO56/jL764PIdgRXLHYVNsd5hHKROYI8TA0fAwtoLrvDI1cBAsNaaeuxBiQ0UQXpQn2 SHmQ== X-Gm-Message-State: AOJu0YxhI8TbtyzbPLpZfyeTC+75zt2cMTuS25M1Cn57fIaPZ/MU2oi0 QFwFqhmBXdMTGcMS2w1o1MS5odrpBaABtUnxgg4rACyDIsP0RC5RZ6MMSSpjFy+17glFEynuufu L X-Received: by 2002:a0c:e38e:0:b0:68f:3ecd:840b with SMTP id a14-20020a0ce38e000000b0068f3ecd840bmr1086525qvl.23.1708108302915; Fri, 16 Feb 2024 10:31:42 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:42 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" Subject: [PATCH 03/10] sched/core: Fix priority checking for DL server picks Date: Fri, 16 Feb 2024 13:31:01 -0500 Message-Id: <20240216183108.1564958-4-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791082095270126652 X-GMAIL-MSGID: 1791082095270126652 In core scheduling, a DL server pick (which is CFS task) should be given higher priority than tasks in other classes. Not doing so causes CFS starvation. A kselftest is added later to demonstrate this. A CFS task that is competing with RT tasks can be completely starved without this and the DL server's boosting completely ignored. Fix these problems. Reviewed-by: Vineeth Pillai Reported-by: Suleiman Souhlal Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 63f41453b79e..0a05caf9d3d7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -162,6 +162,9 @@ static inline int __task_prio(const struct task_struct *p) if (p->sched_class == &stop_sched_class) /* trumps deadline */ return -2; + if (p->dl_server) + return -1; /* deadline */ + if (rt_prio(p->prio)) /* includes deadline */ return p->prio; /* [-1, 99] */ @@ -191,8 +194,24 @@ static inline bool prio_less(const struct task_struct *a, if (-pb < -pa) return false; - if (pa == -1) /* dl_prio() doesn't work because of stop_class above */ - return !dl_time_before(a->dl.deadline, b->dl.deadline); + if (pa == -1) { /* dl_prio() doesn't work because of stop_class above */ + const struct sched_dl_entity *a_dl, *b_dl; + + a_dl = &a->dl; + /* + * Since,'a' and 'b' can be CFS tasks served by DL server, + * __task_prio() can return -1 (for DL) even for those. In that + * case, get to the dl_server's DL entity. + */ + if (a->dl_server) + a_dl = a->dl_server; + + b_dl = &b->dl; + if (b->dl_server) + b_dl = b->dl_server; + + return !dl_time_before(a_dl->deadline, b_dl->deadline); + } if (pa == MAX_RT_PRIO + MAX_NICE) /* fair */ return cfs_prio_less(a, b, in_fi); From patchwork Fri Feb 16 18:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp707381dyb; Fri, 16 Feb 2024 10:33:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU0FQ+0icVzRx9oqUzBfuIEuumzx2kLNDot7PxcSiOJD3A+LCTuVo+sbrBocCMz6QyOnEAuw39dmEUwl7ESithia021AA== X-Google-Smtp-Source: AGHT+IFQtvaRYVm6sO9TnBB8ANTo6oDJBWpHsu/o/Xfdd+6rmJtJQQ56e+5zI3dnf4vHIpSkZ5SB X-Received: by 2002:a05:6a00:1ad2:b0:6e1:25c9:bb29 with SMTP id f18-20020a056a001ad200b006e125c9bb29mr6953521pfv.1.1708108405028; Fri, 16 Feb 2024 10:33:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108405; cv=pass; d=google.com; s=arc-20160816; b=vgdNlqudUNzrjNM1+vs6iucP3S9d1tCy8nY0IEVwVPAZCJJz9yBWOJXg6v6biUxCEp ivC1x080/SlT1MAU6Fa5NbUxmEsXmVGw5LzqxkdutuKHACYbv71BzsW1mWjEkqttplAL Wb9II+tybbqsTyWzVyuZYSVGW+hC+ae1oaLRsnSX8j7eidia/5PSsI9Ks0ESIEkMzBiG QRaXAx/C52OeMeo8KSSoZusBDlPeALbJmsWuf/EKr08BOZ4YbQk57iENslyHleD668pt tqCtMr0DXCLXPzshMzdrf3/u09j40GpZaMDKwywX2bb4M75/dM+TZ+9SerliO+3xYkhf C+rQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SWiejWekyqz80XlkFsn0hVk2ugnWY0u297YrWVho63A=; fh=M2d0eEwkotGwrCl/QH/u/fnmeLJn9ZwWPiMveRgwy+8=; b=o8LWr4VGg/O6O6wLyPAmW/yZ+nh3pErFZcUWE4Sw9Br6/CMX3F/bBecIe5Qq3E8aZY hRpI/LIxQALliQc6S3cmeEuzw88avSUxf16UJXlBEjNRXwz322PSy1wxLLjwEuji0CwF hl4SysFhujj/uzQi4vwyL19kEwNu/W3xT3fA17IPbj227m318CQGy0gE7FpRn8wLn0jM X3/NBOxZkkrGYETeJUQcbU5qWjU7htkLCZ8KC/npf3EwwThDCW1bKDXBdjZCvQNPzB1+ qkTMH+xdtvNQFwRT1Gf8Jytw+OCykGA1U3T9G2vzpDKQnsQlgXS73e1iDC+9u2dBc5hk Wk5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=CeyE2qJQ; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69165-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69165-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m190-20020a633fc7000000b005ceb5338d74si237694pga.510.2024.02.16.10.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:33:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69165-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=CeyE2qJQ; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69165-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69165-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CB2842822B8 for ; Fri, 16 Feb 2024 18:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F94C138492; Fri, 16 Feb 2024 18:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="CeyE2qJQ" Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83F8A135A55 for ; Fri, 16 Feb 2024 18:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108310; cv=none; b=b3nVVwMX2+GYVPkF5FFqXLJAlwRrLK3YUvgBTmTL9TdNe+zEIVXduqLRj8rs1iLxOw556KpXSiOldkfXNJOtOgq4U3+BPEw0aepbs9xGaRXkMzcQBBvJSeMb1x4wqTJU336EHwL8UYXCH4IdbTiVnIaW+2h+bdjMETRyQJHkgF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108310; c=relaxed/simple; bh=hNtzJxrNKpS3WmLYndaWMBO3so/VD/gQO0uqcJZ9FDc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Yteq4Rl/ecr1SEt0ocOq1Gmo3iNK79YkkxxjIpHnlPSj/RmxMNkHRBrFME/p8evDCGNg1TsIwpUMvLw+TPQCS8+NLzLOIMiVTUfT3th/hn59BLH1qVHkE2WrYVJFFC6leRS1h5zmpLeiARwNVrr57EjKlSRCl9qtY+meqPWsR3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=CeyE2qJQ; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-42c758f075dso28644121cf.0 for ; Fri, 16 Feb 2024 10:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108305; x=1708713105; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SWiejWekyqz80XlkFsn0hVk2ugnWY0u297YrWVho63A=; b=CeyE2qJQQJZ35mXekLyB86cXhkXFSbDxRT9lZ9DQpr45yQ9v082goouHNxfg1foozC 6PB0fJ680jVN+s+lLFaJCZ/bRWFow2Ny9QFEHFdwyt61xfpDQ3DCoIvnqdRLe2EUQvr5 xVb1yt0CWobqdlWkhE/97mu1Dwj9co2TipWQA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108305; x=1708713105; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SWiejWekyqz80XlkFsn0hVk2ugnWY0u297YrWVho63A=; b=b6l1gQsoQCB01lIoD4RwT41s611YxKpidN0rpk3BVIbKkjztVo1vB9VK7DQbt+CFvS pQF2yNpmD41AAa4c/K6mFs8h4aoHw3XJJm80jCmZsjDGcjExOstqbYIfgfyHYbBM4hWb qgMOzGmlmNT0ovV4w6VWW0CHKXDqVBSXe1GZY+JkTRrlKIXG8Xgv4p1DZHTojh2L4E9T nLQeF1p6Aq53YD6Fu05qZlkd6lS10DMzBDk6lrNxYtHJm17IjY+HRGCTrexIR3LZBW7e V0UphFHDlZ54aKTb9av74TSO5QORpDLhx+3OUmWUNV8EB59arLKiOPUOhek7IBJfs5V8 ffGQ== X-Gm-Message-State: AOJu0YxcI5fe0yGOWfrzpb40QEo/TU0iQhUyDWBRTKFzlrsvpulNE9Y9 dhemF/OoXVN1uaVVTIFgTESJsbyugTU3IZhzAxHg1JI0YYL1p4gCtTDuZLOo4EIO3KOLptLEv3t 6 X-Received: by 2002:a05:6214:3a8a:b0:68f:1102:680c with SMTP id nz10-20020a0562143a8a00b0068f1102680cmr11071161qvb.5.1708108305165; Fri, 16 Feb 2024 10:31:45 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:44 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" Subject: [PATCH 04/10] sched/core: Fix picking of tasks for core scheduling with DL server Date: Fri, 16 Feb 2024 13:31:02 -0500 Message-Id: <20240216183108.1564958-5-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081478913136870 X-GMAIL-MSGID: 1791081478913136870 * Use simple CFS pick_task for DL pick_task DL server's pick_task calls CFS's pick_next_task_fair(), this is wrong because core scheduling's pick_task only calls CFS's pick_task() for evaluation / checking of the CFS task (comparing across CPUs), not for actually affirmatively picking the next task. This causes RB tree corruption issues in CFS that were found by syzbot. * Make pick_task_fair clear DL server A DL task pick might set ->dl_server, but it is possible the task will never run (say the other HT has a stop task). If the CFS task is picked in the future directly (say without DL server), ->dl_server will be set. So clear it in pick_task_fair(). This fixes the KASAN issue reported by syzbot in set_next_entity(). (DL refactoring suggestions by Vineeth Pillai). Reviewed-by: Vineeth Pillai Reported-by: Suleiman Souhlal Signed-off-by: Joel Fernandes (Google) --- include/linux/sched.h | 3 ++- kernel/sched/deadline.c | 27 ++++++++++++++++++++++----- kernel/sched/fair.c | 22 ++++++++++++++++++++-- kernel/sched/sched.h | 3 ++- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index a1f918674383..e5ad1f232b35 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -672,7 +672,8 @@ struct sched_dl_entity { */ struct rq *rq; dl_server_has_tasks_f server_has_tasks; - dl_server_pick_f server_pick; + dl_server_pick_f server_pick_next; + dl_server_pick_f server_pick_task; #ifdef CONFIG_RT_MUTEXES /* diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index f5aaa3adac94..8fafe3f8b59c 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1567,11 +1567,13 @@ void dl_server_stop(struct sched_dl_entity *dl_se) void dl_server_init(struct sched_dl_entity *dl_se, struct rq *rq, dl_server_has_tasks_f has_tasks, - dl_server_pick_f pick) + dl_server_pick_f pick_next, + dl_server_pick_f pick_task) { dl_se->rq = rq; dl_se->server_has_tasks = has_tasks; - dl_se->server_pick = pick; + dl_se->server_pick_next = pick_next; + dl_se->server_pick_task = pick_task; } int dl_server_apply_params(struct sched_dl_entity *dl_se, u64 runtime, u64 period, bool init) @@ -2271,7 +2273,12 @@ static struct sched_dl_entity *pick_next_dl_entity(struct dl_rq *dl_rq) return __node_2_dle(left); } -static struct task_struct *pick_task_dl(struct rq *rq) +/* + * __pick_next_task_dl - Helper to pick the next -deadline task to run. + * @rq: The runqueue to pick the next task from. + * @peek: If true, just peek at the next task. Only relevant for dlserver. + */ +static struct task_struct *__pick_next_task_dl(struct rq *rq, bool peek) { struct sched_dl_entity *dl_se; struct dl_rq *dl_rq = &rq->dl; @@ -2285,7 +2292,10 @@ static struct task_struct *pick_task_dl(struct rq *rq) WARN_ON_ONCE(!dl_se); if (dl_server(dl_se)) { - p = dl_se->server_pick(dl_se); + if (IS_ENABLED(CONFIG_SMP) && peek) + p = dl_se->server_pick_task(dl_se); + else + p = dl_se->server_pick_next(dl_se); if (!p) { WARN_ON_ONCE(1); dl_se->dl_yielded = 1; @@ -2300,11 +2310,18 @@ static struct task_struct *pick_task_dl(struct rq *rq) return p; } +#ifdef CONFIG_SMP +static struct task_struct *pick_task_dl(struct rq *rq) +{ + return __pick_next_task_dl(rq, true); +} +#endif + static struct task_struct *pick_next_task_dl(struct rq *rq) { struct task_struct *p; - p = pick_task_dl(rq); + p = __pick_next_task_dl(rq, false); if (!p) return p; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b48287629610..9cc528a14001 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8392,6 +8392,14 @@ static struct task_struct *pick_task_fair(struct rq *rq) cfs_rq = group_cfs_rq(se); } while (cfs_rq); + /* + * This can be called from directly from CFS's ->pick_task() or indirectly + * from DL's ->pick_task when fair server is enabled. In the indirect case, + * DL will set ->dl_server just after this function is called, so its Ok to + * clear. In the direct case, we are picking directly so we must clear it. + */ + task_of(se)->dl_server = NULL; + return task_of(se); } #endif @@ -8551,7 +8559,16 @@ static bool fair_server_has_tasks(struct sched_dl_entity *dl_se) return !!dl_se->rq->cfs.nr_running; } -static struct task_struct *fair_server_pick(struct sched_dl_entity *dl_se) +static struct task_struct *fair_server_pick_task(struct sched_dl_entity *dl_se) +{ +#ifdef CONFIG_SMP + return pick_task_fair(dl_se->rq); +#else + return NULL; +#endif +} + +static struct task_struct *fair_server_pick_next(struct sched_dl_entity *dl_se) { return pick_next_task_fair(dl_se->rq, NULL, NULL); } @@ -8561,7 +8578,8 @@ void fair_server_init(struct rq *rq) struct sched_dl_entity *dl_se = &rq->fair_server; init_dl_entity(dl_se); - dl_server_init(dl_se, rq, fair_server_has_tasks, fair_server_pick); + dl_server_init(dl_se, rq, fair_server_has_tasks, fair_server_pick_next, + fair_server_pick_task); } /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4d2c216049cb..bfb15037489c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -338,7 +338,8 @@ extern void dl_server_start(struct sched_dl_entity *dl_se); extern void dl_server_stop(struct sched_dl_entity *dl_se); extern void dl_server_init(struct sched_dl_entity *dl_se, struct rq *rq, dl_server_has_tasks_f has_tasks, - dl_server_pick_f pick); + dl_server_pick_f pick_next, + dl_server_pick_f pick_task); extern void fair_server_init(struct rq *); extern int dl_server_apply_params(struct sched_dl_entity *dl_se, From patchwork Fri Feb 16 18:31:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp707280dyb; Fri, 16 Feb 2024 10:33:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmqAOX2kw+prsYo3fmsXYaqR3AsFztFYG7jr52y7Lq2Bq6vS13TihYIUCtxr0f8P3yub0iCosk10BYOx6u+iVBPMvD3g== X-Google-Smtp-Source: AGHT+IEGICjgnyK8sF7LJZ9d2NNtxVE47CgXEh+R/GH7gZRyem0e9sUoZxEO6D8Dg8cufw1tAi/g X-Received: by 2002:a17:906:7196:b0:a3c:240e:e1db with SMTP id h22-20020a170906719600b00a3c240ee1dbmr4406190ejk.33.1708108393711; Fri, 16 Feb 2024 10:33:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108393; cv=pass; d=google.com; s=arc-20160816; b=Ge1z/dAc/X/tT0zDSPFNTQA+vmd2BeO09pNI/CIpGglWr+6mOtuBao+3GwrDSsmcW0 yYnRQYfAZuG841qgEb6RRecOC58nivwUeKY4ardZ8DXzkvwhZtzhn9TRll7IJ1KmqXn/ 8XZf0urc6lImM17cAIhbJkYE6c1tiOxaPqCACCIhQFAHQ0P2QgdUIBRe4y7kWt/vLk6L rAo2adC7j2hSYOA8qV16VrKnt471G1cTP1gSzEOcP5RfeVazW3D0710drNHWvc7HD0In 5DzfBSOTS4guf9lEWPlATQMwHoW6Qi0ZGrcOc/rK53c6FdJarcJkjrR6k2l0/OR2OJZ2 1CNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zgoJ2Cj2+UUPtAnwZcQw+JcHc1DVxxL4Tm75yla0jg4=; fh=S0c2unB+tmmMkxMgPdLrAVyhLzeGsdpbGVECXBycnRw=; b=MwlvHQ5C/YrchyIDa+W4Bxrqqwbziaap8FU304aBL+89IzBHqTnAhfrgYyKGadG8G/ 8LOl6QjCF+6VgcwfkVxiZiPpZzSDza3Znwdw9lb66/kY2v1w2XKx5gp44RFv8VnNsZun Q+4MJMxjK8mSZnNRRVcUqrsdxK1k9rRqejiKooHs00DctEmuaLsI/n5yIjmlYDJq3KhA TkrHM87EmN8u0jeUOWbhSkakqyc/piBZlo/woCLd3KQGqw6+O7FTjo/AM9vbLQJmK394 G0xNxEuzIHjiEhsRqZaP+vpfxwYLv1YJ+vyiVPZE/F8G0LEz7oOy+l8cA6WB9Ef158pa IlYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=bCBBuWpQ; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69164-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69164-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d18-20020a1709067f1200b00a3d39b3cf35si147941ejr.331.2024.02.16.10.33.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:33:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69164-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=bCBBuWpQ; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69164-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69164-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5486A1F215C7 for ; Fri, 16 Feb 2024 18:33:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0367B137C47; Fri, 16 Feb 2024 18:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="bCBBuWpQ" Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC7B6135A7F for ; Fri, 16 Feb 2024 18:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108310; cv=none; b=At77EbsyA+4PQQ1JAaw5YZa6hfPQvNTphInLJfu3Il+v8G88A7Um4qV2/vQf6KGxUGmYLJUGBg0Ijfbur00mYSzXZjtYBfUekMeIZoqvlcSmhHdWhDj4c9Hs+SWLal+N995qjucWLYU+b8BRjSw77n1Z+uwo2OahxT91+KwNTOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108310; c=relaxed/simple; bh=BdbG0yYlQpcAJTV+cb1BRObS/3sDHMAKLat6xu5MQUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ka16JsMSJnsUFTpR33OIX1S3Yss8+la4r1xVm3GpkaDezPn2WY71I9nR78GSQOPrEQ58etLWvW2KemEHE3Jeg/HxPb7ozXOv90JqJ7MgRDoLQFv1iitnjYCSSjCD/Aq74jhiN7xzAdbHXULMz/fa/JGrAC+0GErYixXnaYGOAvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=bCBBuWpQ; arc=none smtp.client-ip=209.85.219.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-68f429f55b7so559466d6.1 for ; Fri, 16 Feb 2024 10:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108307; x=1708713107; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zgoJ2Cj2+UUPtAnwZcQw+JcHc1DVxxL4Tm75yla0jg4=; b=bCBBuWpQNaNjqeDmb9JQNQd6M4Tf5qyq3qj4KuPzKpG6UNtipEGWIVqM0AWhnRJoJP j/mCSmz0i2+Av6GXBWugAl5tLOrNHQzc3QzFLw0UyoPGwZ+FVj+0y427MX1eQ+O/O+o9 5JXEjxER3QIn4nmdrGrrkTUqcYjZO+eC1y6zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108307; x=1708713107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zgoJ2Cj2+UUPtAnwZcQw+JcHc1DVxxL4Tm75yla0jg4=; b=vbCEcHvy5ga77oqRDNo6tT5LOjo7YIB7h8UEwt3nRIqE47F8zfwZY8vEGLSR78HLgb qJpZDX6mWGc/zuBNOy8ouPzPDECN7wL6Zg9h2sSeMa9DqoxqzjidRl3igI0KA2+3xgwh HMTbBpQiy7FspANSxGI6v8OsHuipzKzm2wH+jAmjxb+pwS6pQcVOJ6ztsq3E5aQW98mh IhryW3lFbZ+HbFyQ5h1BjSe9WC9pkztwVUpGQwoVx0xI0k+lXGJpBu0niXgykLJUGZkV zYntrQYZt+Z8/wp54jtCHd4ghiR5TCJa3T/kHSmMS7ARjCnUsJ6I3Trl0fPuuwdlCPpR TU4g== X-Gm-Message-State: AOJu0YxMIMgWlML+juUMIKHxBEamQ3tyS/fXdm5NItiC+kO8di/VoTQ2 Py7HqYVpvc3Zm1SCTqyiXdqwI3800+ayn5X4xWXgHnpHFlcR7HOu4xDSZu89B9cJEfNvFlbrRWa 6 X-Received: by 2002:a0c:f0ce:0:b0:68e:f036:f5dc with SMTP id d14-20020a0cf0ce000000b0068ef036f5dcmr5456748qvl.15.1708108307279; Fri, 16 Feb 2024 10:31:47 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:46 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" , llvm@lists.linux.dev Subject: [PATCH 05/10] sched/debug: Use unsigned long for cpu variable to prevent cast errors Date: Fri, 16 Feb 2024 13:31:03 -0500 Message-Id: <20240216183108.1564958-6-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081466990850267 X-GMAIL-MSGID: 1791081466990850267 This avoids compiler errors seen with clang: In file included from kernel/sched/build_utility.c:72: kernel/sched/debug.c:532:47: error: cast to 'void *' from smaller integer type 'unsigned int' [-Werror,-Wint-to-void-pointer-cast] debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &fair_server_runtime_fops); Signed-off-by: Joel Fernandes (Google) --- kernel/sched/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index c6c0120ff105..2590041696bc 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -516,7 +516,7 @@ static struct dentry *debugfs_sched; static void debugfs_fair_server_init(void) { struct dentry *d_fair; - unsigned int cpu; + unsigned long cpu; d_fair = debugfs_create_dir("fair_server", debugfs_sched); if (!d_fair) @@ -526,7 +526,7 @@ static void debugfs_fair_server_init(void) struct dentry *d_cpu; char buf[32]; - snprintf(buf, sizeof(buf), "cpu%d", cpu); + snprintf(buf, sizeof(buf), "cpu%lu", cpu); d_cpu = debugfs_create_dir(buf, d_fair); debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &fair_server_runtime_fops); From patchwork Fri Feb 16 18:31:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp711879dyb; Fri, 16 Feb 2024 10:41:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmFRIRdU0yFGorcqb518+8lIoUpSkUJI9CLZBriuUBsYaGLhBK1K5EAEe2NYl/Ei0MFP2BkLgN7AnW2v43m1IOtguEhw== X-Google-Smtp-Source: AGHT+IGItboS8UgxJ8+lWgd9RQCpxmDLWtESsgmb/MFyr5WDO1m3N6iDGv0DPn88ZnHQ4jm2B6VK X-Received: by 2002:aa7:ca4d:0:b0:561:9ca7:bd34 with SMTP id j13-20020aa7ca4d000000b005619ca7bd34mr4505277edt.32.1708108897166; Fri, 16 Feb 2024 10:41:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108897; cv=pass; d=google.com; s=arc-20160816; b=u8GLaWlM8P7bLD0t3QBMnzVMASXyrEPvqE33ypZiirfRbW78U0qQ3pPhKeAkZa/j1A id5wRXypcQQn9xZGx8tw0AXx+nI4QYxx1YBKRP9lCpSbloneq/ScZ32hNVJvA/y0yqdu dOBu1t3YeyRPDHo/oyX+foYKOQiSCdY0mfn716shgl6xgu06H/GZXMz30tkyEtiJ+X6W 2+cIa1dAZiaDxVdLOGkCLQVVizf+uToWTSlofDOGhj41ossU+H+A15Xr0yI4m4BDgx7M fnXHFShGQwmXY6aX/q9JhBe+hpTCE3FEfyQ+zIv63/s+GBVkm1wXnoFUAq4ihV/45/FA 2sEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NIgRVY95Czz2uvDMLBT/P8lHA/YSLsxu7WXMaEzsDZ8=; fh=ZNwPNAR7NMo1z5wvX3GodXZOLclCanONi8hVdvkp3FU=; b=hNvfb0lL0Ipe8MAbMZbzdOJhO8DcpuLooegqnr1MKClsssAIxLJBoRVd0503iNv06r f3rt+HrYWgXPKyHezQPImDd1aj3z1MzTlESzd1rXgvVniFQrvF5BXNs0q5eh5JEinexE ZPk9G7Kh0F3VQtKoE6ThyeqUEfkA89/RwsGUkmce3FZk3kFxYoXLioRkPmz+izlFWed8 u410tKVuNptvryQFPI0vetOPcxYJ7R6C0vaAM+nrNKG6HGE26mlfwIK6qb0Dq164Qy7h EvR3/j1o6LMpXy1Gfw3x1sxefNYdIT96kD5+m4S8q26wVurN6RybFmzuj2R5qpWPX18Y lDsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=glu0DniM; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69166-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u20-20020aa7d894000000b0056215e37846si196187edq.67.2024.02.16.10.41.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=glu0DniM; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69166-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E32A91F23B29 for ; Fri, 16 Feb 2024 18:33:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D7F6137C42; Fri, 16 Feb 2024 18:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="glu0DniM" Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 557F11369A7 for ; Fri, 16 Feb 2024 18:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108312; cv=none; b=lB1tCzJHCRIdnRfbuugMuw0ogXOmQZgZA3eDAdOmw9ApUgoMWp+ENyYuvPGrZ1blpz3HptOFt8vppNataLoZNCTq0QS87rXWupFRHj5RUINha0sVULNoopctIZJSEFcNOo8kXlvvZ1FqCYhHKIVRjMNpJH6UyBikFCXI5/Izkkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108312; c=relaxed/simple; bh=G1fDd4qTQBCk+lDij0THy4jcCMe3hYb5TF5caIUyaxo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lCw0lztQUgbD1qbjH9R4TYO6sAaNryf7dDjLN1A/RPBiyt3BO+e+bu6ZBB90Q0TFFjSSPQR2+dvZtUr3egvPFAmTi5BDg5YXOOogK5QupyApptMV5lGhUJt2FI2TcDWxYdnaJeFi7eZm6K7KOl5E36Y6M/rQ/Fh/lMcjh0aclrg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=glu0DniM; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-68f3fdcb59aso1160786d6.3 for ; Fri, 16 Feb 2024 10:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108309; x=1708713109; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NIgRVY95Czz2uvDMLBT/P8lHA/YSLsxu7WXMaEzsDZ8=; b=glu0DniM+b37P/XLwgGTJaGXenX6CGg6rvtGC/nmjfmDD3KmB/ymPgiB3AujHkbPN2 iWchfmbPBdW+m2Jq4fMtIckhxoiqE74kSFdzJap7CsyZzH3WtvTLoTRl45Grmalfr0Ue 71S50n1jDEc4dNzLFN6xTY6Uwpb5iJYVBef4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108309; x=1708713109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NIgRVY95Czz2uvDMLBT/P8lHA/YSLsxu7WXMaEzsDZ8=; b=BJweHer2GKKudEKUDO7gyKeeUy6NnkIAj5lAvoYIzGChma85J9qdofHJXA38bDM+qU XPM5JsuPkGNnKrV6rFyR4ft5YvUhvZPZTGsSqKcLEG7FU02fSPDyYD6cu19Gy5PmQs2u 4uuJ0BqfKdndPXw1dIkaJaHulZFl/pTc3AnIbht1LIXLinpksw+P0AW0a0JDljUeQyGX FTNZRUWCgTOu755uS4U4ccBqqBdB4K2joUMRNfJ+qPsGfE3Ijk60Nv6fdF0TqI/caw5P aDvrgBPOz5d6T29zJ7K6tkcLUndlHDkkK/BvM+4HUWgIaq2F84tJ3QIfU8hM0SirNJ3b YZWw== X-Gm-Message-State: AOJu0Yzf3Y6mh5/sAGvRZrd6+2Y8A0mAbM8RtEq2+6C5YpNe6CytUCR3 GQycpH44J3aOQFTwJ5e1jQgKacrGz3YxtFOGmOZtyjibxolJ9bjDdpQmwTqXfaWU5CSRtHAdhbq h X-Received: by 2002:a0c:f38d:0:b0:68f:1e7c:5f46 with SMTP id i13-20020a0cf38d000000b0068f1e7c5f46mr4945535qvk.45.1708108309141; Fri, 16 Feb 2024 10:31:49 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:48 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld Subject: [PATCH 06/10] sched: server: Don't start hrtick for DL server tasks Date: Fri, 16 Feb 2024 13:31:04 -0500 Message-Id: <20240216183108.1564958-7-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081994583330065 X-GMAIL-MSGID: 1791081994583330065 From: Suleiman Souhlal Otherwise, we might start it even for tasks in a sched class that should have it off. Signed-off-by: Suleiman Souhlal --- kernel/sched/deadline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 8fafe3f8b59c..5adfc15803c3 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2325,11 +2325,12 @@ static struct task_struct *pick_next_task_dl(struct rq *rq) if (!p) return p; - if (!p->dl_server) + if (!p->dl_server) { set_next_task_dl(rq, p, true); - if (hrtick_enabled(rq)) - start_hrtick_dl(rq, &p->dl); + if (hrtick_enabled(rq)) + start_hrtick_dl(rq, &p->dl); + } return p; } From patchwork Fri Feb 16 18:31:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp707692dyb; Fri, 16 Feb 2024 10:33:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWo2mnF6x+4qtlqcVqJlhWUP9aU9m2wIV54WgIZB5qn5GVDBiwltcOb/g/9tEn3pVa95xDkhA2ZlyPn8jBIim6eeyXmng== X-Google-Smtp-Source: AGHT+IHaJb9FzkJb9s5O9zxNxT2pSm3wWqc98B1fV8MvL/3K+Wq7BgrnVuJ08sLKN0K7cseBQmJ1 X-Received: by 2002:a05:6a20:c89c:b0:19e:cf1a:536d with SMTP id hb28-20020a056a20c89c00b0019ecf1a536dmr6830571pzb.38.1708108437720; Fri, 16 Feb 2024 10:33:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108437; cv=pass; d=google.com; s=arc-20160816; b=oiKcN/CIhL6VqTqiN7nVz9NCKWAc5ZXeYclNI3O6GEEeDN65rX+jq3NeNL2E4zD0/G rJfX6T/TcAnIGur6H/+sThwvZHbKewnBA2Xy8DStuF9XzTy93c3ANjTT1MPyotq4ey5n YhAzg+Wg3x1pYDHfFXla+KI+RQ2uDoLIknxFS0la+XGckhLaEWD+dN2pTohqaPlt8pdh AITSYhEPcx3WACPFXCPUwIWEaA/TI5N42hW8orGPq+/hVzZ9C/uFyvREgcKjzhYUPC3P ft4XojOu8nqS/Lpvpw+Sq/NFI1RPi5ap2TEDwzB4Ryonc9ZiDgh2iM7VZ2ROeJb9F+h/ eP3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KGM3mRROwFt6krNu3XhZIaE8fo5xphzgJ2jbr0QsLYo=; fh=7XehbsakU3DNfctgZlwS4XiVVrNXJeaX3Zomx9nO2A8=; b=H/86YOY5XRMDoXmN8v8L/9jNxkEfI0aBr1nsurZPl5r+Hmkxd/KU1++xW+DaZbPKU/ 261plALTCbIv1RMMUBf5hjAJvE+H/GxY2zFrSqjuSlkfZSfR/pbTqBFnjrD1cgbLg3XR MlfwycMH31e3O3hiJVJx0/Uk+YMz+CWqG1btfufrjN+WTjqSOrqzK/hyKBHh/9MYf25W POWT07GrNiXvbBaoH2HATrSGxj7QynbzpJT6LO0mgoFwp2giSJx8Z9pns23Tnra+P0li CQSbCLY1N40w2zdEO1KdKDkspEMXTnaS/Ennlq0KgThyqI9UaZUWtj5Fn4qiSxQm7fbF V9pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=IWLjp5kO; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69167-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69167-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cb2-20020a056a02070200b005dca5caed31si272892pgb.110.2024.02.16.10.33.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:33:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69167-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=IWLjp5kO; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69167-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69167-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 80FE3282136 for ; Fri, 16 Feb 2024 18:33:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 140B513B291; Fri, 16 Feb 2024 18:32:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="IWLjp5kO" Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB792137C5F for ; Fri, 16 Feb 2024 18:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108316; cv=none; b=lPnuoPQTshDqh4yhPNKlv921wlo/K7jvZJxD3T60j0dge74PerQdfE4lPtV8bhTNmzqtBMxt9Jgk1+yA4Bj1tZJwn4DYzMFNwJ+g0j5Cm90E9wuujSiErgPUx9T2nSVRkfhKHVI4i0p7iGLvH6sURHv3lX7oOlM9EfRhsMU3+ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108316; c=relaxed/simple; bh=OSrAg2NG3ZYsMO+/bzATjsRdKuLLDdxyzjpAKJt8kcI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QmSycv+SglgppT7zIKpLjOUir86yxsdpBpuR9SL0GKO4hjuEZ7g/8+bSmgQkVAhG4eCX1AFmz+mT5qwn/wcNKTpukMQ8ApDC4N6s9Z8xEr4edYYjEmKCGwawase3chghKBNeyZj3ULyM/x6nj9zn4Wa9s6chFjk9zNr8HDpZrYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=IWLjp5kO; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c1333b0974so1781265b6e.1 for ; Fri, 16 Feb 2024 10:31:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108312; x=1708713112; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KGM3mRROwFt6krNu3XhZIaE8fo5xphzgJ2jbr0QsLYo=; b=IWLjp5kOd3hA6PD7W8g/XiIb7drzezRD/dyQvKXbO9e+voJzI6qDg+tRGwSsYNaXJM SotwRPZmBAIxnLIQKZzK1fpWs8YSv/nmO7jSvX1ovtUMs/k+TgAbuPAgm54koNAdgoVs N+fX7a53cfvDMf7h5iM/eUPP+N5ntSylj2QPQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108312; x=1708713112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KGM3mRROwFt6krNu3XhZIaE8fo5xphzgJ2jbr0QsLYo=; b=izAOeDaJKQ/mjAXymzgO6FEzxfLGu7Gan+RK1wySTtnltYWM+awkFyHIAgnNmoLyDE DWMrJlAeDYgOqIwZlcaeNqVceXZc/lYPCaPdbGUujKHUZSoOPxo7D7+MBM9W7EpsJLvl IP4eCfLOuUZNkd6l+xvhJqiIA1Pp3z23KLww732G6FEBtTbiJYtTAnKM0orS/KfuEv0Z Ic5DeRdONv+zLca14+fUzX3r8d1qHn0DlyAGPq+cJ50nVpx9/wzf+51cL5BpszcDw2h/ yLtf2sSeJQ3IORMyf9KlDCsmBv9bpI1bdD5+bq0J59aNMMb5cWLn2dEMKZxmKGo7AVgL vJ8w== X-Gm-Message-State: AOJu0YyugUReleA17wVYX/maCBFEL/o3x/D3kbNIUw4FgJyqaa5z2NI/ aQZyGkaVNj3PC4tjY6PjPcCiDcG2bW0Blj4igho6bScLF8WVPV+aopXkfkuMhNr14buh9bW0sI6 P X-Received: by 2002:a05:6808:1309:b0:3c1:325f:4527 with SMTP id y9-20020a056808130900b003c1325f4527mr6544337oiv.40.1708108311913; Fri, 16 Feb 2024 10:31:51 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:51 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: Suleiman Souhlal , Youssef Esmat , Steven Rostedt , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" , linux-kselftest@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 07/10] selftests/sched: Add a test to verify that DL server works with core scheduling Date: Fri, 16 Feb 2024 13:31:05 -0500 Message-Id: <20240216183108.1564958-8-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081513004490681 X-GMAIL-MSGID: 1791081513004490681 This test verifies that DL server infrastructure gives CFS tasks a fixed bandwidth even when RT tasks are being "core scheduled" on a core. Verify that they are getting the expected bandwidth (and thus not being starved). Also verified that not having core scheduling fixes makes the test fail as the CFS task gets no bandwidth. Sample output: # Runtime of PID 97 is 4.440000 seconds # Runtime of PID 98 is 4.560000 seconds # Runtime of PID 99 is 4.550000 seconds ok 1 PASS Notes about test that generated the sample output: The test runs for 12 seconds. We check the runtimes at 9 seconds. We expect the CFS task (PID 7) to get ~50% of the 9 seconds. The DL server is configured for 50% bandwidth. The RT tasks (PID 98, 99) each get 50% as well, because they run concurrently on 2 hyperthreads of a core. Signed-off-by: Joel Fernandes (Google) --- tools/testing/selftests/sched/Makefile | 13 +- tools/testing/selftests/sched/common.c | 24 ++ tools/testing/selftests/sched/common.h | 8 + .../selftests/sched/cs_dlserver_test.c | 254 ++++++++++++++++++ 4 files changed, 290 insertions(+), 9 deletions(-) create mode 100644 tools/testing/selftests/sched/common.c create mode 100644 tools/testing/selftests/sched/common.h create mode 100644 tools/testing/selftests/sched/cs_dlserver_test.c diff --git a/tools/testing/selftests/sched/Makefile b/tools/testing/selftests/sched/Makefile index 099ee9213557..f491d741cb45 100644 --- a/tools/testing/selftests/sched/Makefile +++ b/tools/testing/selftests/sched/Makefile @@ -1,14 +1,9 @@ # SPDX-License-Identifier: GPL-2.0+ +TEST_GEN_PROGS := cs_dlserver_test -ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) -CLANG_FLAGS += -no-integrated-as -endif +cs_dlserver_test: cs_dlserver_test.c common.c -CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \ - $(CLANG_FLAGS) -LDLIBS += -lpthread - -TEST_GEN_FILES := cs_prctl_test -TEST_PROGS := cs_prctl_test +CFLAGS += $(KHDR_INCLUDES) +CFLAGS += -Wall include ../lib.mk diff --git a/tools/testing/selftests/sched/common.c b/tools/testing/selftests/sched/common.c new file mode 100644 index 000000000000..5cf0022acc8d --- /dev/null +++ b/tools/testing/selftests/sched/common.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "common.h" + +bool hyperthreading_enabled(void) +{ + FILE *file = fopen("/sys/devices/system/cpu/smt/active", "r"); + char smt_active[2]; + + if (file == NULL) { + ksft_print_msg("Could not determine if hyperthreading is enabled\n"); + return false; + } + + if (fgets(smt_active, sizeof(smt_active), file) == NULL) { + perror("Failed to read smt_active"); + return false; + } + fclose(file); + + if (smt_active[0] != '1') + return false; + return true; +} diff --git a/tools/testing/selftests/sched/common.h b/tools/testing/selftests/sched/common.h new file mode 100644 index 000000000000..7bcedbd0ed99 --- /dev/null +++ b/tools/testing/selftests/sched/common.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include +#include "../kselftest.h" + +bool hyperthreading_enabled(void); diff --git a/tools/testing/selftests/sched/cs_dlserver_test.c b/tools/testing/selftests/sched/cs_dlserver_test.c new file mode 100644 index 000000000000..9f2a74a25686 --- /dev/null +++ b/tools/testing/selftests/sched/cs_dlserver_test.c @@ -0,0 +1,254 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Use the DL server infrastructure to give CFS tasks a fixed bandwidth + * even when RT tasks are being "core scheduled" on a core. Verify that + * they are getting the expected bandwidth (and thus not being starved). + * + * Copyright (c) 2024 Google. + * Author: Joel Fernandes + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License as + * published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common.h" + +enum pid_type {PIDTYPE_PID = 0, PIDTYPE_TGID, PIDTYPE_PGID}; + +#define RUN_TIME 12 // Running time of the test in seconds +#define CORE_ID 0 // Assuming we're pinning processes to the first core +#define DL_SERVER_DEBUGFS "/sys/kernel/debug/sched/fair_server" + +void write_server_debugfs(char *file, char *type, unsigned long value) +{ + char path[1024], buf[1024]; + int fd, n; + + snprintf(path, sizeof(path), "%s/%s/%s", DL_SERVER_DEBUGFS, file, type); + fd = open(path, O_WRONLY); + if (fd == -1) { + perror("Failed to open file for writing"); + return; + } + n = snprintf(buf, sizeof(buf), "%lu\n", value); + n = write(fd, buf, n); + if (n == -1) + perror("Failed to write file"); + + close(fd); +} + +void write_dl_server_params(void) +{ + DIR *dir; + struct dirent *entry; + + if (access(DL_SERVER_DEBUGFS, F_OK) == -1) { + perror("DL server debugfs not found, cannot set DL parameters."); + exit(EXIT_FAILURE); + } + + dir = opendir(DL_SERVER_DEBUGFS); + if (dir == NULL) { + perror("Failed to open directory"); + exit(EXIT_FAILURE); + } + + while ((entry = readdir(dir)) != NULL) { + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + continue; + + write_server_debugfs(entry->d_name, "period", 100000000); + write_server_debugfs(entry->d_name, "runtime", 50000000); + } + closedir(dir); +} + +void process_func(void) +{ + unsigned long long count = 0; + time_t end; + + // Busy loop for RUN_TIME seconds + end = time(NULL) + RUN_TIME; + while (time(NULL) < end) { + count++; // Just a dummy operation + } +} + +void set_affinity(int cpu_id) +{ + cpu_set_t cpuset; + + CPU_ZERO(&cpuset); + CPU_SET(cpu_id, &cpuset); + CPU_SET(cpu_id + 1, &cpuset); + + if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset) != 0) { + perror("sched_setaffinity"); + exit(EXIT_FAILURE); + } +} + +void set_sched(int policy, int priority) +{ + struct sched_param param; + + param.sched_priority = priority; + if (sched_setscheduler(0, policy, ¶m) != 0) { + perror("sched_setscheduler"); + exit(EXIT_FAILURE); + } +} + +float get_process_runtime(int pid) +{ + char path[256]; + FILE *file; + long utime, stime; + int fields; + + snprintf(path, sizeof(path), "/proc/%d/stat", pid); + file = fopen(path, "r"); + if (file == NULL) { + perror("Failed to open stat file"); + return -1; // Indicate failure + } + + // Skip the first 13 fields and read the 14th and 15th + fields = fscanf(file, + "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu", + &utime, &stime); + fclose(file); + + if (fields != 2) { + fprintf(stderr, "Failed to read stat file\n"); + return -1; // Indicate failure + } + + // Calculate the total time spent in the process + long total_time = utime + stime; + long ticks_per_second = sysconf(_SC_CLK_TCK); + float runtime_seconds = total_time * 1.0 / ticks_per_second; + + return runtime_seconds; +} + +int main(void) +{ + float runtime1, runtime2, runtime3; + int pid1, pid2, pid3; + + if (!hyperthreading_enabled()) + ksft_test_result_skip("This test requires hyperthreading to be enabled\n"); + + write_dl_server_params(); + + ksft_print_header(); + ksft_set_plan(1); + + // Create and set up a CFS task + pid1 = fork(); + if (pid1 == 0) { + set_affinity(CORE_ID); + process_func(); + exit(0); + } else if (pid1 < 0) { + perror("fork for p1"); + ksft_exit_fail(); + } + + // Create a new unique cookie for the CFS task + if (prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, pid1, PIDTYPE_TGID, 0) < 0) { + perror("prctl for pid1"); + ksft_exit_fail(); + } + + // Create a new unique cookie for the current process. Future + // forks will inherit this cookie. + if (prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, 0, PIDTYPE_TGID, 0) < 0) { + perror("prctl for current process"); + ksft_exit_fail(); + } + + // Create an RT task which inherits the parent's cookie + pid2 = fork(); + if (pid2 == 0) { + set_affinity(CORE_ID); + set_sched(SCHED_FIFO, 50); + process_func(); + exit(0); + } else if (pid2 < 0) { + perror("fork for p2"); + ksft_exit_fail(); + } + + // Create another RT task which inherits the parent's cookie + pid3 = fork(); + if (pid3 == 0) { + set_affinity(CORE_ID); + set_sched(SCHED_FIFO, 50); + process_func(); + exit(0); + } else if (pid3 < 0) { + perror("fork for p3"); + ksft_exit_fail(); + } + + sleep(RUN_TIME * 3 / 4); + runtime1 = get_process_runtime(pid1); + if (runtime1 != -1) + ksft_print_msg("Runtime of PID %d is %f seconds\n", pid1, runtime1); + else + ksft_exit_fail_msg("Error getting runtime for PID %d\n", pid1); + + runtime2 = get_process_runtime(pid2); + if (runtime2 != -1) + ksft_print_msg("Runtime of PID %d is %f seconds\n", pid2, runtime2); + else + ksft_exit_fail_msg("Error getting runtime for PID %d\n", pid2); + + runtime3 = get_process_runtime(pid3); + if (runtime3 != -1) + ksft_print_msg("Runtime of PID %d is %f seconds\n", pid3, runtime3); + else + ksft_exit_fail_msg("Error getting runtime for PID %d\n", pid3); + + // Make sure runtime1 is within 30% of runtime2 + if (runtime1 < 0.7 * runtime2 || runtime1 > 1.3 * runtime2) + ksft_exit_fail_msg("Runtime of PID %d is not within 30%% of runtime of PID %d\n", + pid1, pid2); + + // Make sure runtime1 is within 30% of runtime3 + if (runtime1 < 0.7 * runtime3 || runtime1 > 1.3 * runtime3) + ksft_exit_fail_msg("Runtime of PID %d is not within 30%% of runtime of PID %d\n", + pid1, pid3); + + waitpid(pid1, NULL, 0); + waitpid(pid2, NULL, 0); + waitpid(pid3, NULL, 0); + + ksft_test_result_pass("PASS\n"); + return 0; +} From patchwork Fri Feb 16 18:31:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp713614dyb; Fri, 16 Feb 2024 10:45:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVshKraA3SXNwJbwBzGqYzzih0blLSrrrPKnWx9mL81cUdqIrR1e74ZDSsXCHqwSwpp6IX2FxarixCMpeDMDnOsKBKyJg== X-Google-Smtp-Source: AGHT+IEQp8vMRwiSfETdVZjhCzV8yQ1NBZDab2wQdm/wWVYU44dVgex5J4cyZ1VB9zLLg3Oy0/7X X-Received: by 2002:a05:6a21:9101:b0:1a0:7b0c:e067 with SMTP id tn1-20020a056a21910100b001a07b0ce067mr6136364pzb.29.1708109111731; Fri, 16 Feb 2024 10:45:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708109111; cv=pass; d=google.com; s=arc-20160816; b=N3p6pQL5NSzh8RPZHly8k7QwKXFwOpr1Bw5beCTmG7Z4IQQqArxoXt+uzgQD5QTqnO 79Jxl4+QbI4dNezEm075hn4LPW8q7GHH+U8YK2hqz136Gy15nCbXvP1TbOSBZn7S4A51 O97MNzJzQLMxEPnK2M8UtrLUAEx6PGdlDlXArmxXfZJ9r9blvSTbBem0Dtio0e77+9rO qH5ZXAo+w5IMGC4pze60ipqB3d5x1yGU9kkjTKbP6oAGlE3mezM4gI+RlkF7DXPle3LI s1XVQmB9L/yM+fuyCM7etf79dot/QCyVgnyLcVm9c2J1L9vIWH0pH4BC9QLB0zaDjTPw f5oQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CDhDd9Kfjsqh4jLKpVf7J36w/JnuAi2f5V71QMuGAEk=; fh=4pJ4mchRYFrfBfvhSl5jDG/kQHpiAx8Hz7po5TFQYfc=; b=hVSPGjMIYDi7GBUR3OshmcxAyt0pu+BDCNoF4whWDUxRofeNkaf+VbAsbPpZfZfsHc 9apuEgYOKRWNxh7S+dCwAwWCQ0hONh9/G489CNqBknr9fNJ9XmR9Npw8UQTgkKXxyp2J 5ZSZBOYF1wAnaf7LgmEI1pw2TGsNs6g8qeLxVJWf9h6q5zTNaA39uR6p0FvXtZbfeZA9 /sFGC3oj4YJg8OVYR/gZAoaAE1pI+dgtmBKMXfu/SVODu27CafmkxURYbKbTpt+vG3E4 GG2fhMXWqOQaC9dt6SPA4yh9HzO5gvMMENeX/FCtAw+KfHAd6MtPyOGBlmmnnt5RGWVz +FjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=T1FQqQW9; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69168-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t29-20020a056a00139d00b006e04f0080f9si279126pfg.405.2024.02.16.10.45.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:45:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=T1FQqQW9; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69168-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CE9E0B25946 for ; Fri, 16 Feb 2024 18:34:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 039A4145B0D; Fri, 16 Feb 2024 18:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="T1FQqQW9" Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ECFB134CCE for ; Fri, 16 Feb 2024 18:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108319; cv=none; b=m35VZ1lFWRBhaEtmLG7oMsQl9LdRpRRKvaB18PsVFnxq3k+y2rqDImRc9b5bqP8KUTwDm8IXIVPwwQkVC+6TFyC0WoKC4LIb6hu/3lrSIjpwSwW9FJXbAacgAMtttmOiCZPl1MXBYgOpTGQGXoq9d96C75jRhsmEP65a6P98WVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108319; c=relaxed/simple; bh=mZ2gOIXcUxYPUWs6+iWh+plbgTcX3Uoy+H9V33hkCIo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QkXXf+iTroUwqpWgtgTcwzpeVQmzY8fwEDEd+QO11aqc1tpXe25QC74HSzz1zDu+vslG5ecW8DRubooIJ8+R6n14MOU8c1yLibMmhFSPn4PFD3NccxzJFAJ6yWoUTth0GyuChJu1OY4jxdpue5au4vYr4UO8dPEn93epnf1wVX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=T1FQqQW9; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-686a92a8661so11902706d6.0 for ; Fri, 16 Feb 2024 10:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108314; x=1708713114; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CDhDd9Kfjsqh4jLKpVf7J36w/JnuAi2f5V71QMuGAEk=; b=T1FQqQW9TyHh7HgT+F67Khdj1PilhW3VPjsjqYihnfFaIn7pw8ggciDJAkQGDTSSBI iqoTmDz6YS4G1PF1+7y7A17Uu3oZhNRu0a1tRPTOqV+6v3KDzJ2nGLwkEIUejXwMqCkv bEyROjqgxfZs9uHnGSFc68A/67hVrl3WKckNk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108314; x=1708713114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CDhDd9Kfjsqh4jLKpVf7J36w/JnuAi2f5V71QMuGAEk=; b=lI3ISlLeHh3kPa+wHgN3Ii5S+WxW5iHf78G/gZDmtEkA+OaYDlAwjdbqXsXwUW4pji Y0atdckzYXe5M4Gn654kAzRRsPsuZcg1fQ6SyvI5BZK74pY258lKOGdSGPyZ67Gz5zlm vUkrr2s51tp3+fDCM8aNde8pIeWo+SYiSvV8cb8Yw+OEZUA4y8vAH7DlLxouJjVF7Qct yVDnR7x6IDWqpf4LUJqW+CPMlof2GhKsYJ4zg/S4ltRFqYmYqN75NgBFp6oolrzHME8+ slxky6gvzSCzxtu2fof+m12UipATb072nLchOLKsFGgpo6EQ+egLAVTONybV28kmOMMG 7EBQ== X-Gm-Message-State: AOJu0YyR721HDtnq1q6diSwu93X/KZ89iTEW4wBgRSoPVrcNo1/z9/FN +Qgs5QXYC7w2eNCyO7nR5aHmi+1nPIoOGKP6I5V0L/3ECOg8HIh+7OyIDO1yuXmz1zdACo2DdVq n X-Received: by 2002:a05:6214:5904:b0:68c:668b:c610 with SMTP id qo4-20020a056214590400b0068c668bc610mr7398414qvb.2.1708108314017; Fri, 16 Feb 2024 10:31:54 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:53 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Shuah Khan Cc: Suleiman Souhlal , Youssef Esmat , Steven Rostedt , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" , linux-kselftest@vger.kernel.org Subject: [PATCH 08/10] selftests/sched: Migrate cs_prctl_test to kselfttest Date: Fri, 16 Feb 2024 13:31:06 -0500 Message-Id: <20240216183108.1564958-9-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791082219752557134 X-GMAIL-MSGID: 1791082219752557134 This test begs to be a kselftest, is in the kselftest hierarchy and does not even use a single kselftest API. Convert it. It simplifies some of the code and the output also looks much nicer now: Totals: pass:17 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Joel Fernandes (Google) Reviewed-by: Chris Hyser Acked-by: Shuah Khan --- tools/testing/selftests/sched/Makefile | 6 +- tools/testing/selftests/sched/cs_prctl_test.c | 74 ++++++++++--------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/tools/testing/selftests/sched/Makefile b/tools/testing/selftests/sched/Makefile index f491d741cb45..90c53bc1337e 100644 --- a/tools/testing/selftests/sched/Makefile +++ b/tools/testing/selftests/sched/Makefile @@ -1,9 +1,11 @@ # SPDX-License-Identifier: GPL-2.0+ TEST_GEN_PROGS := cs_dlserver_test - -cs_dlserver_test: cs_dlserver_test.c common.c +TEST_GEN_PROGS += cs_prctl_test CFLAGS += $(KHDR_INCLUDES) CFLAGS += -Wall include ../lib.mk + +$(OUTPUT)/cs_dlserver_test: cs_dlserver_test.c common.c +$(OUTPUT)/cs_prctl_test: cs_prctl_test.c common.c diff --git a/tools/testing/selftests/sched/cs_prctl_test.c b/tools/testing/selftests/sched/cs_prctl_test.c index 7ba057154343..bb7aee703cdf 100644 --- a/tools/testing/selftests/sched/cs_prctl_test.c +++ b/tools/testing/selftests/sched/cs_prctl_test.c @@ -28,10 +28,11 @@ #include #include #include -#include #include #include +#include "common.h" + #if __GLIBC_PREREQ(2, 30) == 0 #include static pid_t gettid(void) @@ -80,7 +81,7 @@ static int _prctl(int option, unsigned long arg2, unsigned long arg3, unsigned l int res; res = prctl(option, arg2, arg3, arg4, arg5); - printf("%d = prctl(%d, %ld, %ld, %ld, %lx)\n", res, option, (long)arg2, (long)arg3, + ksft_print_msg("%d = prctl(%d, %ld, %ld, %ld, %lx)\n", res, option, (long)arg2, (long)arg3, (long)arg4, arg5); return res; } @@ -91,21 +92,20 @@ static int _prctl(int option, unsigned long arg2, unsigned long arg3, unsigned l static void __handle_error(char *fn, int ln, char *msg) { int pidx; - printf("(%s:%d) - ", fn, ln); + ksft_print_msg("(%s:%d) - ", fn, ln); perror(msg); if (need_cleanup) { for (pidx = 0; pidx < num_processes; ++pidx) kill(procs[pidx].cpid, 15); need_cleanup = 0; } - exit(EXIT_FAILURE); + ksft_exit_fail(); } static void handle_usage(int rc, char *msg) { - puts(USAGE); - puts(msg); - putchar('\n'); + ksft_print_msg("%s\n", USAGE); + ksft_print_msg("%s\n\n", msg); exit(rc); } @@ -117,7 +117,7 @@ static unsigned long get_cs_cookie(int pid) ret = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, pid, PIDTYPE_PID, (unsigned long)&cookie); if (ret) { - printf("Not a core sched system\n"); + ksft_print_msg("Not a core sched system\n"); return -1UL; } @@ -160,7 +160,7 @@ static int child_func_process(void *arg) ret = write(ca->pfd[1], &ca->thr_tids, sizeof(int) * ca->num_threads); if (ret == -1) - printf("write failed on pfd[%d] - error (%s)\n", + ksft_print_msg("write failed on pfd[%d] - error (%s)\n", ca->pfd[1], strerror(errno)); close(ca->pfd[1]); @@ -192,7 +192,7 @@ void create_processes(int num_processes, int num_threads, struct child_args proc for (i = 0; i < num_processes; ++i) { ret = read(proc[i].pfd[0], &proc[i].thr_tids, sizeof(int) * proc[i].num_threads); if (ret == -1) - printf("read failed on proc[%d].pfd[0] error (%s)\n", + ksft_print_msg("read failed on proc[%d].pfd[0] error (%s)\n", i, strerror(errno)); close(proc[i].pfd[0]); } @@ -202,30 +202,29 @@ void disp_processes(int num_processes, struct child_args proc[]) { int i, j; - printf("tid=%d, / tgid=%d / pgid=%d: %lx\n", gettid(), getpid(), getpgid(0), + ksft_print_msg("tid=%d, / tgid=%d / pgid=%d: %lx\n", gettid(), getpid(), getpgid(0), get_cs_cookie(getpid())); for (i = 0; i < num_processes; ++i) { - printf(" tid=%d, / tgid=%d / pgid=%d: %lx\n", proc[i].cpid, proc[i].cpid, + ksft_print_msg(" tid=%d, / tgid=%d / pgid=%d: %lx\n", proc[i].cpid, proc[i].cpid, getpgid(proc[i].cpid), get_cs_cookie(proc[i].cpid)); for (j = 0; j < proc[i].num_threads; ++j) { - printf(" tid=%d, / tgid=%d / pgid=%d: %lx\n", proc[i].thr_tids[j], + ksft_print_msg(" tid=%d, / tgid=%d / pgid=%d: %lx\n", proc[i].thr_tids[j], proc[i].cpid, getpgid(0), get_cs_cookie(proc[i].thr_tids[j])); } } puts("\n"); } -static int errors; - #define validate(v) _validate(__LINE__, v, #v) void _validate(int line, int val, char *msg) { if (!val) { - ++errors; - printf("(%d) FAILED: %s\n", line, msg); + ksft_print_msg("(%d) FAILED: %s\n", line, msg); + ksft_inc_fail_cnt(); } else { - printf("(%d) PASSED: %s\n", line, msg); + ksft_print_msg("(%d) PASSED: %s\n", line, msg); + ksft_inc_pass_cnt(); } } @@ -254,13 +253,17 @@ int main(int argc, char *argv[]) keypress = 1; break; case 'h': - printf(USAGE); + ksft_print_msg(USAGE); exit(EXIT_SUCCESS); default: handle_usage(20, "unknown option"); } } + if (!hyperthreading_enabled()) { + ksft_exit_skip("This test requires hyperthreading to be enabled\n"); + } + if (num_processes < 1 || num_processes > MAX_PROCESSES) handle_usage(1, "Bad processes value"); @@ -272,17 +275,22 @@ int main(int argc, char *argv[]) srand(time(NULL)); - /* put into separate process group */ + /* Put into separate process group */ if (setpgid(0, 0) != 0) handle_error("process group"); - printf("\n## Create a thread/process/process group hiearchy\n"); + ksft_print_header(); + + /* Increase the count if adding more validate() statements. */ + ksft_set_plan(17); + + ksft_print_msg("\n## Create a thread/process/process group hiearchy\n"); create_processes(num_processes, num_threads, procs); need_cleanup = 1; disp_processes(num_processes, procs); validate(get_cs_cookie(0) == 0); - printf("\n## Set a cookie on entire process group\n"); + ksft_print_msg("\n## Set a cookie on entire process group\n"); if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, 0, PIDTYPE_PGID, 0) < 0) handle_error("core_sched create failed -- PGID"); disp_processes(num_processes, procs); @@ -296,7 +304,7 @@ int main(int argc, char *argv[]) validate(get_cs_cookie(0) == get_cs_cookie(pid)); validate(get_cs_cookie(0) == get_cs_cookie(procs[pidx].thr_tids[0])); - printf("\n## Set a new cookie on entire process/TGID [%d]\n", pid); + ksft_print_msg("\n## Set a new cookie on entire process/TGID [%d]\n", pid); if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, pid, PIDTYPE_TGID, 0) < 0) handle_error("core_sched create failed -- TGID"); disp_processes(num_processes, procs); @@ -305,7 +313,7 @@ int main(int argc, char *argv[]) validate(get_cs_cookie(pid) != 0); validate(get_cs_cookie(pid) == get_cs_cookie(procs[pidx].thr_tids[0])); - printf("\n## Copy the cookie of current/PGID[%d], to pid [%d] as PIDTYPE_PID\n", + ksft_print_msg("\n## Copy the cookie of current/PGID[%d], to pid [%d] as PIDTYPE_PID\n", getpid(), pid); if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_TO, pid, PIDTYPE_PID, 0) < 0) handle_error("core_sched share to itself failed -- PID"); @@ -315,7 +323,7 @@ int main(int argc, char *argv[]) validate(get_cs_cookie(pid) != 0); validate(get_cs_cookie(pid) != get_cs_cookie(procs[pidx].thr_tids[0])); - printf("\n## Copy cookie from a thread [%d] to current/PGID [%d] as PIDTYPE_PID\n", + ksft_print_msg("\n## Copy cookie from a thread [%d] to current/PGID [%d] as PIDTYPE_PID\n", procs[pidx].thr_tids[0], getpid()); if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_FROM, procs[pidx].thr_tids[0], PIDTYPE_PID, 0) < 0) @@ -325,7 +333,7 @@ int main(int argc, char *argv[]) validate(get_cs_cookie(0) == get_cs_cookie(procs[pidx].thr_tids[0])); validate(get_cs_cookie(pid) != get_cs_cookie(procs[pidx].thr_tids[0])); - printf("\n## Copy cookie from current [%d] to current as pidtype PGID\n", getpid()); + ksft_print_msg("\n## Copy cookie from current [%d] to current as pidtype PGID\n", getpid()); if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_TO, 0, PIDTYPE_PGID, 0) < 0) handle_error("core_sched share to self failed -- PGID"); disp_processes(num_processes, procs); @@ -340,20 +348,16 @@ int main(int argc, char *argv[]) validate(_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_TO, 0, PIDTYPE_PGID, 1) < 0 && errno == EINVAL); - if (errors) { - printf("TESTS FAILED. errors: %d\n", errors); - res = 10; - } else { - printf("SUCCESS !!!\n"); - } - - if (keypress) + if (keypress) { + ksft_print_msg("Waiting for keypress to exit\n"); getchar(); - else + } else { sleep(delay); + } for (pidx = 0; pidx < num_processes; ++pidx) kill(procs[pidx].cpid, 15); + ksft_finished(); return res; } From patchwork Fri Feb 16 18:31:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp707846dyb; Fri, 16 Feb 2024 10:34:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOuKiUdDR9b5mjaCThwlqZYu8D/zCEjgQUeNHXPxNM8si1s0OEWx2UCD5KOncuVZ5zpUh4qZpu8nYXs8uVzwJ3UkEtQQ== X-Google-Smtp-Source: AGHT+IHMqp2Qo1PHV2znjsg50uYZWft6pw3p7HGXMeYa/mlRkkOC5XwEXpk2HDu5x5dHJdYL6XVT X-Received: by 2002:a05:6e02:4c6:b0:365:a00:d9c0 with SMTP id f6-20020a056e0204c600b003650a00d9c0mr3639714ils.18.1708108457289; Fri, 16 Feb 2024 10:34:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108457; cv=pass; d=google.com; s=arc-20160816; b=Fz6REJP7diLs+kLwm6X9ei82se0QfEADdp0kwxk3k/cfoonaD7ZjeJOVcHkuWH1J1o 927xFR95pxbStS3YMh7nS5PhwICt/wi1keEN9z+IVBnGEkamvl2fjsYS0RX9WrEnpSAj Ucmqc8OxGpp9sKhZL3ETovNmB54zk1sRf270BqoS4grF+0MxRgk98KsH7eZWNXQAp83g fI79XVF++m6l5R0GXpN0sO2WLGtuPp3iExXZ7Ley14Vu23OKUXjlLlZASjMQkIMrxFwV qKcJPDtgwflwaO9ow8TJmYL3/zRd2bvwp3vvao+MOH8ieARGZV5pzlhU+dw+7HjjUQxK Oolg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+jDrn7wgy/ve0lPoR/xKtbF/cZLSIaETTt3wbkL2858=; fh=K2Kz/eAb/U54MmPeXcijjli4rR+tPap83sNy8Z96/EI=; b=09hn3idRDfJn5GVAsLohEwaZ2/MwIKD8dQ9XlZbhn9r7lnkEMQZZ4uxzztbL0DsNLc BgREShsWQ6QvjgpoQfd1EIz32RkyxC4YBszAR23fG3bLS/s6+poeZ75qgWqJvTPm0Fmo 99eFw3FsVbUeXVT4otd5K9MpuLrVEbWt6HTxWcQQT5o6KjGCz6i3RAAIeI3ISTW2gXAX hD7ZpL//5Tqb5icZfHpTRMd2YxG2My152U2hnUc3eG+LoEQhWuP8DXea7OvVWI4nT3fm xYyrxAG+UDZna1q8LfhQrWb5vT1PpLX3K5cRVHIO0nsLKgMmyK2kLIC8YJDZzJ91s7ab lBgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=g5RWjmtE; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69169-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69169-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q21-20020a638c55000000b005d8b313de26si241991pgn.594.2024.02.16.10.34.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:34:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69169-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=g5RWjmtE; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69169-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69169-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 15072282ADE for ; Fri, 16 Feb 2024 18:34:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3354145324; Fri, 16 Feb 2024 18:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="g5RWjmtE" Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42DDE1350D2 for ; Fri, 16 Feb 2024 18:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108319; cv=none; b=J5Lj/P+yfAsOqpKQ/U02wu2+oW44FH4nP99PCMWO9IjsJhB12B5n1kcUnPjo+syaCtmBsVv16EWS0Z9aZCdMEI02tlj37uHcZrAzIV9KW4luqlv4VSSEdxlWtzGsTRzGhle+BRsXkAwXezWTYG9mu2yAPEc6z3fIwOn9Ir8ibGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108319; c=relaxed/simple; bh=cu3MMzOHuWJKImjKqYJ4/NXYAdw+8BhcKEGy95D0Imk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YVEgxKwXQuy5HhsAqPP4G4PjDxHU1FUrRSVrqAPZD4ZBZ/4FR1UjI89uKZxmz/8Kqzw8ly1jQMBXaSksQsjpydtR2Cm8VxzROqWFCb3v2czKDT6uOdCC65SPAmdqnq5jgdixo/MzCBbL2KlgmTMmvevLBy5spIlk0fsxkekgAZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=g5RWjmtE; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6818aa07d81so15849196d6.0 for ; Fri, 16 Feb 2024 10:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108316; x=1708713116; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+jDrn7wgy/ve0lPoR/xKtbF/cZLSIaETTt3wbkL2858=; b=g5RWjmtE4GeWFZAaV/uIOkmk7lxOE7p7YrGvVJmAcKzXvTzNblJIjIzroSJ1DZOx8s 10g4s5s2oVoLfPMsw/ZdSlJcCRY/0V6duVc/nPqY+7wYUNTvLMH+bgC1ZNqZWi3hLG1Y Yg244tgwGgsbBZ1rcW/qjluZ+b7u7d335ytdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108316; x=1708713116; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+jDrn7wgy/ve0lPoR/xKtbF/cZLSIaETTt3wbkL2858=; b=WAIQu2v4gTMzLeSE93OM23AF12QpTKC2BO8Gl/awIoRkI2bVmQATw5UhqnZ14vVdxy D5C7SBR94dGqEGwZVBKOqM2uN3MfguDVFz6Ic1KZ3/3YA9QY0J8mLRmy9+6EJgvKKz7H +X45+zHTeTt7TNoMkB6vVuYnxMWJ6+lKb1TgbOO9ro2CJ9BGybK0nY0E6e/SVkgIeBXX Omx/XmkYgLwmdSS5Fep6hTyebL8+fbm13Dpp8U1uWSZ7WBih7RDtkifH2xE4rq3lS0NY W2f1cdugKnj0pN+2gZLL29Xm6kBwl9qhSBTZ5HVi0dx8Hi/e+ApzpJ2J+bmwGytgJCaV NYSA== X-Gm-Message-State: AOJu0YzspS2xvuJnMoAkk1Dr+aVfnqS03PZl/iaX262nm9Xkz7mDygNa N03HPQSYGPzhNeoL8EaJJwrFTiE/2RKhP3zLncWe3lYreeIANRvIvpHnWhGIt0kUHd9zJyImtci w X-Received: by 2002:a0c:ca0f:0:b0:68f:144f:4c4 with SMTP id c15-20020a0cca0f000000b0068f144f04c4mr6750511qvk.37.1708108316068; Fri, 16 Feb 2024 10:31:56 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:55 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Pawan Gupta , Jonathan Corbet Cc: Suleiman Souhlal , Youssef Esmat , Steven Rostedt , David Vernet , "Paul E . McKenney" , joseph.salisbury@canonical.com, Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" , linux-doc@vger.kernel.org Subject: [PATCH 09/10] admin-guide/hw-vuln: Correct prctl() argument description Date: Fri, 16 Feb 2024 13:31:07 -0500 Message-Id: <20240216183108.1564958-10-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081533685733181 X-GMAIL-MSGID: 1791081533685733181 Correct the description for arg4 which appears to be outdated. Signed-off-by: Joel Fernandes (Google) --- Documentation/admin-guide/hw-vuln/core-scheduling.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/hw-vuln/core-scheduling.rst b/Documentation/admin-guide/hw-vuln/core-scheduling.rst index cf1eeefdfc32..338d639a8127 100644 --- a/Documentation/admin-guide/hw-vuln/core-scheduling.rst +++ b/Documentation/admin-guide/hw-vuln/core-scheduling.rst @@ -62,8 +62,8 @@ arg3: arg4: ``pid_type`` for which the operation applies. It is one of - ``PR_SCHED_CORE_SCOPE_``-prefixed macro constants. For example, if arg4 - is ``PR_SCHED_CORE_SCOPE_THREAD_GROUP``, then the operation of this command + ``PIDTIME_``-prefixed macro constants. For example, if arg4 + is ``PIDTYPE_TGID``, then the operation of this command will be performed for all tasks in the task group of ``pid``. arg5: From patchwork Fri Feb 16 18:31:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 202309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp707939dyb; Fri, 16 Feb 2024 10:34:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbx3Z4NCkGoZLBivdzi0eL9x7a+ys4IQhmPqrZqvDbz5FOo+h2DCprI3h4hCMNFUnle1p1p++partnDtrtNFrfTqtFHQ== X-Google-Smtp-Source: AGHT+IF96xQ26yFKJCOa0Tgaarg2q135qfm950yeWP04Qy8LluK/dDlBJxn2Ebi6ECYSfpcglpi3 X-Received: by 2002:a17:902:7843:b0:1db:be98:e9a with SMTP id e3-20020a170902784300b001dbbe980e9amr571691pln.26.1708108469839; Fri, 16 Feb 2024 10:34:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108469; cv=pass; d=google.com; s=arc-20160816; b=t45p6mMYg0Fl3zCwMsslnS5DFy5RVyH7cgrfgfcNZEUYADO5q1KCJs2L6Z6ruH2hi2 CwMgrmT+su2d0Ut/eUVvPwC08Oqy5joTj5aDDAKB3DuSKoHv+I/inKO7+Y/DsEl4NVLb 0bSiw+quj1j40OgYQc8fz+hdZ+ui3eGN3fWbBqh2LVOqyhYUA2matvwKW8P5Zke/wqyj im/zvG4/XTfJ7zB1ERft791SiPS6M6YGPj3qow0u+nE3b8OI/EzmhOw+w/LjFXZ1NPNb 1yXQtuoXvzFeayCPuyd9ICEgyU8NIhbApzCO1oektbsoLoium1NUEu6oHSXULcF6MZgD LWjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yHQc0zFqwpbzybw0LbQrYD8RqgFtXPcRDLH11DqCLn4=; fh=M2d0eEwkotGwrCl/QH/u/fnmeLJn9ZwWPiMveRgwy+8=; b=Eizx2P7ImHVh195cOq6eiJiKxF6gSttFe94+CmL2AXm9jfumBLKGrvQYIgY4qNTfDf AdTI3bU5RVifOUxmMTT+tcsFoq9p4H+IjPBUngTfvnuu87DPSAw+ielLuYSAnJSypMfR gIQ8QVn7A8i+AGq4l9gWUg90RLmAhUKkP51xB/Z5HpSoRuYpgdw4oQS29JhZ7FTuN+H5 g/9RRy4Rlm2UtZVJS4l3ETJxAvJ+vb/TrP8urGifUO0rR9ngH6sHf2U9H4CoOVSzu5Jb ve1UGMeaABcbmQGRIU9AaKXpy01lwbxATYyLIUUVRcmcE9h291C76o9M98TUm+ARQBzF HPvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RTI3IZt0; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69170-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69170-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b001d944e92be8si237206plg.146.2024.02.16.10.34.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:34:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69170-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RTI3IZt0; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-69170-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69170-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 80232282CE0 for ; Fri, 16 Feb 2024 18:34:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C90E145B22; Fri, 16 Feb 2024 18:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="RTI3IZt0" Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC92013A88C for ; Fri, 16 Feb 2024 18:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108321; cv=none; b=XdayfiBthx4Jh1CX2fcq8kcw8TrCWcTyvfmb2or0Os8xhQJzPaR08CAudiapJ1tpZ3GENSxHTbVPOoKsFLZ90+F9ncnVbgtD4Znw5x2CAOTuahdtwQh+/VQAoOzzAm+/weV6MgC4HpmCWjTuI3kb+JnF28YlbVhgplzmm6yh2q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108321; c=relaxed/simple; bh=o8njkdLQwpeSFKVUbv1Vgg6wMteGEmlFXV/7brtrrq4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mb9xhuBtoiClZH7c0H6DOQk/Zdld1n59kCl8z+DfpiNRnRJxpvOCOcqAXUBJbiEhjW+GLhnJm5Tev1k5AnfCnre99Uyq5GzGZFk0mNws3wbi3EyI630Tpl1ziWGMjxSKBAiMg1bykk01Nb7AdlXcRmTAvsi9Pk/d2PeUUjAHeVw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=RTI3IZt0; arc=none smtp.client-ip=209.85.222.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7872ade6f0aso55512985a.1 for ; Fri, 16 Feb 2024 10:31:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1708108318; x=1708713118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yHQc0zFqwpbzybw0LbQrYD8RqgFtXPcRDLH11DqCLn4=; b=RTI3IZt0wq+6/wGYTtp0kX1KgE7ZTrBGCvNgfzdabuTMLsiY9itQArhMd4Cikoz1ez ceKRROrCAzSjh0xtzAFtiQ7821XRu97ZZulp+iJ0U4Ykm0QMomY+SUG5ezJ692/NMXXI frFVKtK/uZgvnfi0rW0z2hyVfaZ40NXxwsKs0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108318; x=1708713118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHQc0zFqwpbzybw0LbQrYD8RqgFtXPcRDLH11DqCLn4=; b=cn4iOX+rB2Dk+aQ2iDPqQZWA+OJLC+FEbgRDplIo370kP2Oy6AI4tnYVxez46bpYYs UIB+IG0vak3ZBN/bbQuWw7QTtFaSONOxcN++/d1c9gaacNCvHpd/APsa0iJV+oaPcZU3 hKC2i4iNgM+ZOAYRT0WcjO5FDuOcsq74ljOUfDumkSHQbhdewnQV26SnH8q3BHj2HdQs Udacy6ytLWO6zkfrQENa5/n2XzLs1Nqbl64RiwmxxlY/IXwOHZQRx0Q/RLuJaAqvEMet /N+djVGq43hC4MUyoVCSdtjLDJYgTSdGoqwxJvYsTAQpzCiPCJTjAaND67v2/lcNKRf4 fQtQ== X-Gm-Message-State: AOJu0YwYWkpLVP4r8s2kai0dg/zXh3PTOTbry8FCZbMdtbFA3L4sD24v iq33UAMx1zTexibELaI7rknMteKaQXbSmtdgPWP8jYCUhj4aPMy8Ht4tDPUJzSsYDHZtzhcx7MX n X-Received: by 2002:a0c:f38d:0:b0:68f:1e7c:5f46 with SMTP id i13-20020a0cf38d000000b0068f1e7c5f46mr4946028qvk.45.1708108317858; Fri, 16 Feb 2024 10:31:57 -0800 (PST) Received: from joelbox2.. (c-98-249-43-138.hsd1.va.comcast.net. [98.249.43.138]) by smtp.gmail.com with ESMTPSA id nd13-20020a056214420d00b0068cdadb5e7esm159722qvb.31.2024.02.16.10.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:31:57 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Suleiman Souhlal , Youssef Esmat , David Vernet , Thomas Gleixner , "Paul E . McKenney" , joseph.salisbury@canonical.com, Luca Abeni , Tommaso Cucinotta , Vineeth Pillai , Shuah Khan , Phil Auld , "Joel Fernandes (Google)" Subject: [PATCH 10/10] sched: Fix build error in "sched/rt: Remove default bandwidth control" Date: Fri, 16 Feb 2024 13:31:08 -0500 Message-Id: <20240216183108.1564958-11-joel@joelfernandes.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216183108.1564958-1-joel@joelfernandes.org> References: <20240216183108.1564958-1-joel@joelfernandes.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791081547184127516 X-GMAIL-MSGID: 1791081547184127516 This fixes a build error introduced by "sched/rt: Remove default bandwidth control". The issue happens because a function is unused when !CONFIG_SMP. It could be squashed into the original patch. Signed-off-by: Joel Fernandes (Google) --- kernel/sched/rt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 37bee56a70f7..d3065fe35c61 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -964,8 +964,10 @@ struct rt_rq *sched_rt_period_rt_rq(struct rt_bandwidth *rt_b, int cpu) return &cpu_rq(cpu)->rt; } +#ifdef CONFIG_SMP static void __enable_runtime(struct rq *rq) { } static void __disable_runtime(struct rq *rq) { } +#endif #endif /* CONFIG_RT_GROUP_SCHED */