Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8079208rwb; Tue, 6 Dec 2022 13:47:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rWW52AnGq5MXiuQ/ZiWU8GNG8UvjMQXnd9noHKxA5xzzuD7qDOsUyKMxOgSpgPFdD7XWi X-Received: by 2002:a17:906:12c2:b0:7bd:1606:2da1 with SMTP id l2-20020a17090612c200b007bd16062da1mr43987701ejb.33.1670363249853; Tue, 06 Dec 2022 13:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670363249; cv=none; d=google.com; s=arc-20160816; b=BG33Q7Bt+3FBN3ybwmrE+ITV5XwKDKTQ8gvNNfMCcsDOXUtFaT1BP1GZIb+mrEfF8h gKR85Nlcow+uEYSZIvto8/M1IjknYSIGVjlJlJX9J80COXadnNl2IziV6+gJC6tqHj6W oeSbrvUVwBP8pRTHgx0vmNs7Amji2ZnGX8H0Rptv6b4b2Y7RzprvuERbrvxC8yypC/Dd YOtj5bGJT9zfytNmCn53hj32vzO46YmXJ2bmF1Dw6wz3RszTnN8PGVaOvse/2p+IDDW6 MaA3BIM6TwJcGwAaBxYn2Q0IS4xjTI9D4ITliJMi9xk/Y2Nn4jMNJv6Yd9bxzcDMWj8s MEjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=CjJnMDyt/NNp+Ep12ubSTLl5hV1ShtEgJ1DJNEKSYuI=; b=Gu8eYhs64+AgKyXD+Z1pC9LCW0OykjzTc+Es7RSK0+DAWG+pBnggfrt5HXAK2iVZX9 mxhiQU6O4Md83NO32j9l8MbVg60Pptbh76A4XkhGavHnZNmgpELDOjlYZZmvGrZL1Wj6 GCG5le4kILPZhhaNgSGEfe18KFsSldCJFE3plyca73o+mx4BzQjHgfLDTFMdWHUYXyB/ 3cYJOmPbygfaBBEv05K0MKNJox+Te8jc/UknWVqu4y3UUATc0LCHbH68WXEF+Fldjm6T WwWo1E7knFUkTJYRSQL8888tA72jBwYNPXoBykN7Zmr46+R0+VDshO3xBk/X1rPJIT0T DUBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RMNnhQfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a50d6d1000000b00469d35e2f13si2464907edj.522.2022.12.06.13.46.58; Tue, 06 Dec 2022 13:47:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RMNnhQfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbiLFVmd (ORCPT + 77 others); Tue, 6 Dec 2022 16:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbiLFVmb (ORCPT ); Tue, 6 Dec 2022 16:42:31 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6333E48761; Tue, 6 Dec 2022 13:42:30 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id w23so15223774ply.12; Tue, 06 Dec 2022 13:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=CjJnMDyt/NNp+Ep12ubSTLl5hV1ShtEgJ1DJNEKSYuI=; b=RMNnhQfUcUNpgEo82iPLWj7vrC0aDD0MjKOfj9jlvUlGQUaaOAZ6xXcyJ3Kv50bFJm YSknEoJh7BNPJ5ti/NGZDQa+2HqwE1QPw68hCMaIIL2WG37/mDgj+Ezv9vBnjyob4HhX t/5xVnoYmlAMNGc6qXAyBQZA8hCpxrBGhIaYxjWpj2IGRpPsNNq/7/wV+ymZQEQgQ7LS sRGc6CLzPTK9rK+8hsicPVolWrpUdQnA07lDdS9B9Kr7aH/rLloZf4SM2cCPO1E46tq/ /bKzbLmd+Hwy6qbohxBIbvzbAQEEhaUcQkQMxwDcwUh14SNwjLQFJQ0s/JutIi2SCff8 u2Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CjJnMDyt/NNp+Ep12ubSTLl5hV1ShtEgJ1DJNEKSYuI=; b=iwYvLvRIkWAandsGExtaN2mTUKsOwjgiX/hQtyE4Q5v1/F44QlQZ1csNLGhq5T2hK6 vtc1dIQlqFpdV2/wNeUwSrIZXH4ZSQYDc5faXENr31IDcuZzvaGsy/ppsv+XsxxqtSg7 rApxrMQ5oAGDJtFkFOnivUuVuiZmidwOiUAR98nDH2Vh6mqOiyoMirti7YSk4tzWF7GL iAbpaEHJuz+YWbEgOed+ghohwmmGYcFSChYTnLL1shNC5tpLKvyXwEwqy0QAen3JCYe4 zDCNo8R3m+I3CbJHncy7JXOdeaAUrhYbjDUhqvmOz0WD0tx+LhN674SAeFQkhPuqEQgt 8p7g== X-Gm-Message-State: ANoB5pngv8sC257au8CLSECL4kvsKQIR0gd3M6r3J+sfQEzWBWM2qG2U 7QUAF2HSQ5uD1AXc5avDIA8= X-Received: by 2002:a17:90b:35cb:b0:213:22d:b2e2 with SMTP id nb11-20020a17090b35cb00b00213022db2e2mr40628251pjb.148.1670362949601; Tue, 06 Dec 2022 13:42:29 -0800 (PST) Received: from localhost ([2620:10d:c090:400::5:841a]) by smtp.gmail.com with ESMTPSA id s24-20020a17090ad49800b00210125b789dsm11272853pju.54.2022.12.06.13.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 13:42:29 -0800 (PST) Sender: Tejun Heo Date: Tue, 6 Dec 2022 11:42:27 -1000 From: Tejun Heo To: Barret Rhoden Cc: torvalds@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org, joshdon@google.com, pjt@google.com, derkling@google.com, haoluo@google.com, dvernet@meta.com, dschatzberg@meta.com, dskarlat@cs.cmu.edu, riel@surriel.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 14/31] sched_ext: Implement BPF extensible scheduler class Message-ID: References: <20221130082313.3241517-1-tj@kernel.org> <20221130082313.3241517-15-tj@kernel.org> <8d146099-a12a-c5a1-4829-dec95497fdca@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Barret. On Fri, Dec 02, 2022 at 08:01:37AM -1000, Tejun Heo wrote: > > you still end up grabbing both locks, but just not at the same time. > > Yeah, this probably would look better than the current double lock dancing, > especially in the finish_dispatch() path. > > > plus, task_rq_lock() takes the guesswork out of whether you're getting p's > > rq lock or not. it looks like you're using the holding_cpu to handle the > > race where p moves cpus after you read task_rq(p) but before you lock that > > task_rq. maybe you can drop the whole concept of the holding_cpu? > > ->holding_cpu is there to basically detect intervening dequeues, so if we > lock them out with TASK_ON_RQ_MIGRATING, we might be able to drop it. I need > to look into it more tho. Things get pretty subtle around there, so I could > easily be missing something. I'll try this and let you know how it goes. I tried both and I'm pretty ambivalent. The problem is that the finish_dispatch() path can't use TASK_ON_RQ_MIGRATING the way the consume path does because the dispatch path isn't starting with the task locked. The only claim it has to the task is through p->scx.ops_state. It can be argued that getting rid of double locking is still nice but given that holding_cpu is needed anyway and can play the same role, I'm not sure how attractive it is. I suppose we can go either way. Thanks. -- tejun