Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754797AbeAMI0r (ORCPT + 1 other); Sat, 13 Jan 2018 03:26:47 -0500 Received: from mail-ua0-f195.google.com ([209.85.217.195]:33109 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754680AbeAMI0q (ORCPT ); Sat, 13 Jan 2018 03:26:46 -0500 X-Google-Smtp-Source: ACJfBov0XjhwUw3q7p3N3Jp2Psob1Rw8ZtA+9x006NfTP7dudzwUbmTUhpANlkQChy7SRff8E9j6JgmJh9/dVUuhuNk= MIME-Version: 1.0 In-Reply-To: <1513613712-571-1-git-send-email-joshs@netflix.com> References: <20171218113426.vndsy2m5qhxrkesg@hirez.programming.kicks-ass.net> <1513613712-571-1-git-send-email-joshs@netflix.com> From: Balbir Singh Date: Sat, 13 Jan 2018 13:56:44 +0530 Message-ID: Subject: Re: [PATCH v2] delayacct: Account blkio completion on the correct task To: Josh Snyder Cc: Peter Zijlstra , Brendan Gregg , Tejun Heo , linux-block@vger.kernel.org, Jens Axboe , Ingo Molnar , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Dec 18, 2017 at 9:45 PM, Josh Snyder wrote: > Before commit e33a9bba85a8 ("sched/core: move IO scheduling accounting from > io_schedule_timeout() into scheduler"), delayacct_blkio_end was called after > context-switching into the task which completed I/O. This resulted in double > counting: the task would account a delay both waiting for I/O and for time > spent in the runqueue. > Yes, we included the time spent in the runqueue to delays on account of I/O. > With e33a9bba85a8, delayacct_blkio_end is called by try_to_wake_up. In > ttwu, we have not yet context-switched. This is more correct, in that the > delay accounting ends when the I/O is complete. But delayacct_blkio_end > relies upon `get_current()`, and we have not yet context-switched into the > task whose I/O completed. This results in the wrong task having its delay > accounting statistics updated. > > Instead of doing that, pass the task_struct being woken to > delayacct_blkio_end, so that it can update the statistics of the correct > task. > > Fixes: e33a9bba85a8 ("sched/core: move IO scheduling accounting from io_schedule_timeout() into scheduler") > Signed-off-by: Josh Snyder > --- Acked-by: Balbir Singh