From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD72C4320A for ; Fri, 27 Aug 2021 21:41:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25968600CD for ; Fri, 27 Aug 2021 21:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbhH0Vly (ORCPT ); Fri, 27 Aug 2021 17:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbhH0Vlw (ORCPT ); Fri, 27 Aug 2021 17:41:52 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AE2CC0613D9 for ; Fri, 27 Aug 2021 14:41:03 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id k65so15066650yba.13 for ; Fri, 27 Aug 2021 14:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2ELnHnxXQ3QKSTdHlPecFhJXpaQDWJHo6ZXwtcu8mbA=; b=Gakvhq/oe6wU40pIbOYYGPVeL5YgWg0l54zjb5tE81IMBOtnBqEEVvNmMDgEXYWo13 71KoElCe/ZiIC6qzbwxH94bercCT1Jg1oXjMo3KNJVVP2oHS5yV+fnZkUPWckJ/KB0l8 piME4THWlyVVM82Bivlb+Ig7+TRnsDFuY5pEUZqDUtkaiboEM+FXMdoMlyyQzXhlZ/Ad bDRDHWvsmSgQhGQnqqd39pgtB+zAVrYv6kYBzBgZuDkHtRjJVc9qDnZy3FfhjOdLLBs3 2p/Qiesaw2WmneOZ0IomHmDanONP1LsTtw8N8rqLjk/KT35TpWeQlLzRJorcHhn21a8M W1fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2ELnHnxXQ3QKSTdHlPecFhJXpaQDWJHo6ZXwtcu8mbA=; b=txgH5m8EdpZq0SvE+u9NXjWCV7yH0x8UOXbCpGHLkby5N4Mtz2pbRefXjbzhBy+OEr C9KxMhokXBHZ6pT63ll8gOKLnFNO77YRFB3hZDfCLPdVgiDquK8gUeUazoFQFinWLAf4 TaX5zWju7/DK5ux/UJUUG3xbxk/nCHvLbHql7Jc0qDwFgoncBKp7w7yWzZuBFXwMnok9 dMuTe9mrdkfQUCk2UVrssofgu/jTSgclnMWiuLfd60bfylL7YNy43CplQrMqhFLP6Oum Dei6w97GcPL0ZHVIUirU0jWQO0qXOj6FXnDeNlWM37MBkMHHWTGPJlNGvH2AC6y841yO lTCA== X-Gm-Message-State: AOAM530Y7LCbnHPONVH4m5JSKJx8Y4ckWEFSRjge8Gf7hC0h4+KMFpPr vGooITpe7PJb5Rd/lSImwuhkhZbO6tHoD3zjdGY8UA== X-Google-Smtp-Source: ABdhPJy5n7jbk99nqbGBpad3XSf1FlO1SZfJHp1ei/llIwEUOHBR8CcP6NEx4ig0dovWgxsj5xRd9Lts7rsQ36dLWx0= X-Received: by 2002:a25:e747:: with SMTP id e68mr7919019ybh.446.1630100462006; Fri, 27 Aug 2021 14:41:02 -0700 (PDT) MIME-Version: 1.0 References: <20210827165438.3280779-1-joshdon@google.com> In-Reply-To: <20210827165438.3280779-1-joshdon@google.com> From: Eric Dumazet Date: Fri, 27 Aug 2021 14:40:50 -0700 Message-ID: Subject: Re: [PATCH v2] fs/proc/uptime.c: fix idle time reporting in /proc/uptime To: Josh Don Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , LKML , linux-fsdevel , Luigi Rizzo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 9:55 AM Josh Don wrote: > > /proc/uptime reports idle time by reading the CPUTIME_IDLE field from > the per-cpu kcpustats. However, on NO_HZ systems, idle time is not > continually updated on idle cpus, leading this value to appear > incorrectly small. > > /proc/stat performs an accounting update when reading idle time; we can > use the same approach for uptime. > > With this patch, /proc/stat and /proc/uptime now agree on idle time. > Additionally, the following shows idle time tick up consistently on an > idle machine: > (while true; do cat /proc/uptime; sleep 1; done) | awk '{print $2-prev; prev=$2}' > > Reported-by: Luigi Rizzo > Signed-off-by: Josh Don > --- > SGTM thanks ! Reviewed-by: Eric Dumazet