Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1589918rwi; Wed, 19 Oct 2022 12:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AFI4kg4sumpR/AIaP7GOplDNuxwoQAYwYBNtFPR1JQQn0OPeFVZHQMAiGMIuDBy7P4Go2 X-Received: by 2002:a17:906:5dac:b0:78d:fa65:a4a9 with SMTP id n12-20020a1709065dac00b0078dfa65a4a9mr7867362ejv.223.1666208257193; Wed, 19 Oct 2022 12:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666208257; cv=none; d=google.com; s=arc-20160816; b=lLN2xN97EB0PCNfBBiZL5kzsLevKnj+4GuQ7kDfxasjbzdKuw4oXc/FlLJ4QE2g1Mu CsothFEjiUBmx6kyN/kfIBKI9IyQifX1hQ7psH8z1JSmCNFRdA38HQm0QPeQK6CuIMlc vPWQJP7IqgukM1nBeQELblntsnVgByyShkbTcwfPvC+WFfizsRufsAx7ucU5V/QHJh5x 13I8zSiw3xdk2j15TJGJLH6k4rwY4/7ok4BD2NQWdSjkAHYQUKn4P9ui6Pk8y5nQxDO6 trwbfpVvsCxXh52g4Ho3SKefxOcWjUR+MjvjpnbtjHOeyXG5g9J+CDW7Gqu0Ze8qycdB ksfw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VWTVUzZSPgyErG0K1bIQIObQY5FrTpMGy0tgMmfzvHA=; b=mbuseMjb2fzgU/GaVpsVFMRQTDd7I3L9t2b+c7blK1sVhTZ7iYLQSaKN+woJOcBTuR 6/qBsFoS8sbbyyEqa4JLihZ8Ae/IwVFf8ZPu8QcJ8GJTNeyuWdMG3sy9J+Ctp8YSp1/z j4yFthrLRsMSesh2vVwRyqwOEwOK+4VHxIBV/iRldqjvVz2KfIL4f3iquTTwO726Is8o IjJ7ngOM5L2W5GXKPQ567v7z+nljR3tmvZd3WeYP+A7egV4kdrT2t+4nqXVlR6pkuXoB WMMm92l9EDasAKncoPX9rHry8lExtq8mqYeWbXMuqWu/Gnp9LGUOY7FII+wvRPcQ7wNW 8HMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20210112.gappssmtp.com header.s=20210112 header.b=VVud+TV3; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg14-20020a170907320e00b00780805b99ccsi16804112ejb.648.2022.10.19.12.37.11; Wed, 19 Oct 2022 12:37:37 -0700 (PDT) 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=@layalina-io.20210112.gappssmtp.com header.s=20210112 header.b=VVud+TV3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJSTae (ORCPT + 99 others); Wed, 19 Oct 2022 15:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiJSTaZ (ORCPT ); Wed, 19 Oct 2022 15:30:25 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D433E102DED for ; Wed, 19 Oct 2022 12:30:19 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id az22-20020a05600c601600b003c6b72797fdso723016wmb.5 for ; Wed, 19 Oct 2022 12:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=VWTVUzZSPgyErG0K1bIQIObQY5FrTpMGy0tgMmfzvHA=; b=VVud+TV38lIgoqq/7ycSuPRBEPJDbIelERT4/Duhq9o8XCgVHoeQkxqwz6xeBZIfWo fJI2+GI/PxnUtnJiDh0HprF3YjF5Bte1njeUdEKgUpSCZLMu2K4mz8qDVBBaP45cIAZj QvTuDQnlPMGFIKDYv27XQEuLQ/bkbk35EmD/AKGYpQzmqxLVZ7xSeVp2u6Jt/fJ207PR ocAlO+jdjGVF5XI8o4DKlh3gWxaHYO8VAKvpTikfGWvlrY4Hf2uzHPeq04l1ud7XC9+h vde3NivYT2Jjd6O9tlTYYNN/S30wMqjfLs4cFrmV+jutMN5cnKYziSq0RL5ZKyIKJ0n7 IbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VWTVUzZSPgyErG0K1bIQIObQY5FrTpMGy0tgMmfzvHA=; b=W7+pPVEuYftwvsjDu8f+tDuoZR/XPgM1lBFP+mVjDnuoOphrgOtd9EHem9FzFpPpnX 6iKkWzfonTjnFVy4KSmsRtUitMOqwvaw9Qi4Tz2IchIXPLm36PLQ4EJLzt3mbo2jre1P vdcmBwKcfJbZWFz3eUjToZ2I0POW2RDrBkDL0lE5HgfxanuDcpuyECshpFnfFhOQw5iB F+Bhj71I/Ps96FS8ENANIapcqSxDOq2bS3gyneaT61OL8uHzwgWNFAB0UAaKrZheZGQt HpR2qF+K1FMBNmg+KV7NrqHDtAnk4WvYffjCj8+rAah9pAyBaA+AqdNsyTNVflkiR5h1 VkuA== X-Gm-Message-State: ACrzQf0VZs8k4GfS+pJYIZpU+QZUXUL3Wb6NsxdfL11pLLWtcw82DLLM PavZgYGlEnisb3CO7BTtitxhpw== X-Received: by 2002:a05:600c:5127:b0:3c6:47ff:5d33 with SMTP id o39-20020a05600c512700b003c647ff5d33mr7324420wms.68.1666207818247; Wed, 19 Oct 2022 12:30:18 -0700 (PDT) Received: from airbuntu (host86-130-134-87.range86-130.btcentralplus.com. [86.130.134.87]) by smtp.gmail.com with ESMTPSA id s15-20020adfeb0f000000b0022cdeba3f83sm13959023wrn.84.2022.10.19.12.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 12:30:17 -0700 (PDT) Date: Wed, 19 Oct 2022 20:30:15 +0100 From: Qais Yousef To: Juri Lelli Cc: Joel Fernandes , Connor O'Brien , linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Qais Yousef , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Subject: Re: [RFC PATCH 00/11] Reviving the Proxy Execution Series Message-ID: <20221019193015.mczb4ew2m4h2qjjy@airbuntu> References: <20221019114357.yipijpetxz7ns5aq@airbuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 10/19/22 15:41, Juri Lelli wrote: > On 19/10/22 08:23, Joel Fernandes wrote: > > > > > > > On Oct 19, 2022, at 7:43 AM, Qais Yousef wrote: > > > > > > On 10/17/22 02:23, Joel Fernandes wrote: > > > > > >> I ran a test to check CFS time sharing. The accounting on top is confusing, > > >> but ftrace confirms the proxying happening. > > >> > > >> Task A - pid 122 > > >> Task B - pid 123 > > >> Task C - pid 121 > > >> Task D - pid 124 > > >> > > >> Here D and B just spin all the time. C is lock owner (in-kernel mutex) and > > >> spins all the time, while A blocks on the same in-kernel mutex and remains > > >> blocked. > > >> > > >> Then I did "top -H" while the test was running which gives below output. > > >> The first column is PID, and the third-last column is CPU percentage. > > >> > > >> Without PE: > > >> 121 root 20 0 99496 4 0 R 33.6 0.0 0:02.76 t (task C) > > >> 123 root 20 0 99496 4 0 R 33.2 0.0 0:02.75 t (task B) > > >> 124 root 20 0 99496 4 0 R 33.2 0.0 0:02.75 t (task D) > > >> > > >> With PE: > > >> PID > > >> 122 root 20 0 99496 4 0 D 25.3 0.0 0:22.21 t (task A) > > >> 121 root 20 0 99496 4 0 R 25.0 0.0 0:22.20 t (task C) > > >> 123 root 20 0 99496 4 0 R 25.0 0.0 0:22.20 t (task B) > > >> 124 root 20 0 99496 4 0 R 25.0 0.0 0:22.20 t (task D) > > >> > > >> With PE, I was expecting 2 threads with 25% and 1 thread with 50%. Instead I > > >> get 4 threads with 25% in the top. Ftrace confirms that the D-state task is > > >> in fact not running and proxying to the owner task so everything seems > > >> working correctly, but the accounting seems confusing, as in, it is confusing > > >> to see the D-state task task taking 25% CPU when it is obviously "sleeping". > > >> > > >> Yeah, yeah, I know D is proxying for C (while being in the uninterruptible > > >> sleep state), so may be it is OK then, but I did want to bring this up :-) > > > > > > I seem to remember Valentin raised similar issue about how userspace view can > > > get confusing/misleading: > > > > > > https://www.youtube.com/watch?v=UQNOT20aCEg&t=3h21m41s > > > > Thanks for the pointer! Glad to see the consensus was that this is not > > acceptable. > > > > I think we ought to write a patch to fix the accounting, for this > > series. I propose adding 2 new entries to proc/pid/stat which I think > > Juri was also sort of was alluding to: > > > > 1. Donated time. > > 2. Proxied time. > > Sounds like a useful addition, at least from a debugging point of view. They look useful addition to me too. > > > User space can then add or subtract this, to calculate things > > correctly. Or just display them in new columns. I think it will also > > actually show how much the proxying is happening for a use case. > > Guess we'll however need to be backward compatible with old userspace? > Probably reporting the owner as running while proxied (as in the > comparison case vs. rtmutexes Valentin showed). > Or invent a new task_state? Doesn't have to be a real one, just report a new letter for tasks in PE state. We could use 'r' to indicate running BUT.. Cheers -- Qais Yousef