Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1152018rwi; Wed, 19 Oct 2022 07:18:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gLabwq6Gqz5S+S/DjLjdAUqB3nVV0mQIjuoJ4uZqCDLJD3UQS2790gqx5qP45j1ZP0QTJ X-Received: by 2002:a63:211d:0:b0:44e:f294:8440 with SMTP id h29-20020a63211d000000b0044ef2948440mr7287089pgh.103.1666189082752; Wed, 19 Oct 2022 07:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189082; cv=none; d=google.com; s=arc-20160816; b=G7+phsVZmYz2s60p9GJgItY+3TnHPMJRBee4GLxLcFskbpdfk0F1F/S6z7A+yUO8bC GtVArsFhDJ/M+0Zeka7jVDEolSvxQ6fAalQJZbR01AMNxgFgiWIODSy4afLSz0W88+na 1uA1bouWtjeEg7/V3shOnE6N/7dYuDO/bpnnDUbmjTl8GuYSskTxvN9LwDK/3Sx6OiL7 FI3oINy0998OmIXZzCjpUcsDd31A0XZSOgAE70mrCZzT6DbxYFWZZ/7NN0p6iLxelDUs XxhqU4bh7NmtzM0W4glfItzuLS/0c9+Ki+97fBycgeY7Nekvzr7EKXRPRK6NXTgh/WdX rCAA== 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=P/ejTOn5apSyXH3oKsqag9ewPFfVKrJTc7t7+ljEoJ0=; b=byFX2ZZLgBmcLGJYS9Rq7Wanev6rrKkMGOAxmhDrbANPA3XJjll3V5e9SpdJ3elXnI zuz+Fa8ZL8EoajIjtwPYvykR+w65inIfkTe7XCHHETp0K3p4p36zMEqD/Uo83gt0K4ZO jmYW84j4dx4bYhSZAsDa0i+Od09//l4JpdYNhxR9NbBxpGgRfots5HNYjSvWO5gHiDDJ mN6gQxxxociwJMP+6jgxhg1kbMXlJJy0yhK4F9ATAL+qk6up7rqKUdp+ZNs0mU5iWWk5 /27k1hpXYQv9NmYHaMayUDDbwYBRgInMjCCHBFysQOAfF50PmZmhTAduCvxIXsrAWQyR sCeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DgO+mH7f; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c24-20020a637258000000b0041183daa0ffsi17247225pgn.761.2022.10.19.07.17.48; Wed, 19 Oct 2022 07:18:02 -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=@redhat.com header.s=mimecast20190719 header.b=DgO+mH7f; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232209AbiJSOCj (ORCPT + 99 others); Wed, 19 Oct 2022 10:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiJSOCJ (ORCPT ); Wed, 19 Oct 2022 10:02:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DB3E18B48A for ; Wed, 19 Oct 2022 06:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666186904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/ejTOn5apSyXH3oKsqag9ewPFfVKrJTc7t7+ljEoJ0=; b=DgO+mH7fT2aExiMVSg02X+x7NrDSmeUpdJLhsDxESnjB3IIJLfo77m2FnmdsAlkttoKTRP 65Q/VfxZWbj8Zm/tR6EtrKkGhfWtNkGCM3CN1H0smkrwOkE/8yul8/ERUYrxvFu0aUuaNu vSNx+MdCY7IpfWvzRlAo32hfJJFNv9s= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-84-DH7D2Tj_OymtCnr3a-0EXg-1; Wed, 19 Oct 2022 09:41:43 -0400 X-MC-Unique: DH7D2Tj_OymtCnr3a-0EXg-1 Received: by mail-qt1-f199.google.com with SMTP id c11-20020ac87dcb000000b0039cdb815f3bso9700166qte.4 for ; Wed, 19 Oct 2022 06:41:43 -0700 (PDT) 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=P/ejTOn5apSyXH3oKsqag9ewPFfVKrJTc7t7+ljEoJ0=; b=L+WhZ48RcnflV2xRmVaPUqkT5Ei2QluLxSVVXY8ioTQtqPT6yTHDv6xnPurd6ARN3m baXWYvyvoNLUZcwxC1/I98jguIDwtxOzXkBd/p+MlkeNMjVhscQoyJmIuMmRVMf2sjvX p04pKXKZlcTZ06+aLx4UDU19Z78NnBObOHvCIKuYPBkSh9Gq2TfqPwGbDP5YcHhyVSI0 3ZMxh/1PKGFRfiarVLJ723Ukp/y+Imzwad/iKtfZ9FqUUYs9yDa7axMDo1rmH1/EeT6a BU6nQJ4J+lKc8+r94rzVTybZ5h9ukIdlf3NED8lufPnZNL33GuxAsscAM7Xvr8EzR4On +4Cw== X-Gm-Message-State: ACrzQf3ovho1Sbh459kVyCQOuLyfK70mojUm4VDLPoo7girwYShCgXj+ DDaRv7wMSpmlp4CF0utBmAG4Uogach1t3Mt4WBw88Cj2HsS5o61yXBI0Fwe5ozID/c6J7RrBWeI 23XOnABOz1szUie0OTeBE4HN9 X-Received: by 2002:a05:620a:40c9:b0:6ed:562d:ee0 with SMTP id g9-20020a05620a40c900b006ed562d0ee0mr5586568qko.750.1666186902332; Wed, 19 Oct 2022 06:41:42 -0700 (PDT) X-Received: by 2002:a05:620a:40c9:b0:6ed:562d:ee0 with SMTP id g9-20020a05620a40c900b006ed562d0ee0mr5586529qko.750.1666186902010; Wed, 19 Oct 2022 06:41:42 -0700 (PDT) Received: from localhost.localdomain ([151.29.54.101]) by smtp.gmail.com with ESMTPSA id p16-20020a05620a057000b006aedb35d8a1sm4832412qkp.74.2022.10.19.06.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 06:41:41 -0700 (PDT) Date: Wed, 19 Oct 2022 15:41:29 +0200 From: Juri Lelli To: Joel Fernandes Cc: Qais Yousef , 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: 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=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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. > 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).