Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp732403pxa; Wed, 5 Aug 2020 11:22:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKcd6Ik2kouBZSeb9chEDhiMD5iffHl5i5ThzE9KITb5gxGq5ghKNnFC+x9RDl14fuOemD X-Received: by 2002:a05:6402:16d1:: with SMTP id r17mr507622edx.79.1596651733336; Wed, 05 Aug 2020 11:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596651733; cv=none; d=google.com; s=arc-20160816; b=szJHoMDrvCiWAtkD7XmLbNnIK9sAvjcig2I5sm0Xct7eUNlP5H4RQ8tlUxABHGOAUP H/278lJkFaWHttu/DL7RniY6vFU4pFQpA9QrZUWUMV8Rt9Ts83mEIGIW3M2Iu896BeZo mi3T5FFkcd6/I7AFeXZE+NKdkqkVGhLU1+ogk89xJXH4VAQ+P8rsB+VFBHt+/4rZVAfy dCmo3XVj4qJXy0U7FY+8lwdJA7Fg7772lPMzebyrQfn3g6m90DeDEcJYmp/7nTPMnwgY RcdJSIgwk3hwLTDQ5K6E1/gdh35IfIphyRXQ4+FFZ1NRepF86idvQaqEsZS1Ea4z0clY x70g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=QTs20Y2uQb75JxoibU08BQmlRKaNqO3ksWubKbOLAMk=; b=kDANkEF5fZHpACwwfl6LmiUfp69N8TOzbvoBMQHNNKMU64AoYdKJeagej9V+7Hr1qx 5QHFlSUiPF3rVW7RdH/YzBjAjY9r1ds8EBWs0o5BHjbYB9yvDJ6J9hjR/F0RRoEhPqLM TdtBhLBJzrUj8vi4ulyHRUvJtsTaEl0V5XbItMsT4XvAkMldrwedKkpDqbg+A17WS6bb cNXu+ptO6GNlVyzjP0Kw+y2/ArQ27ZpLUUrtzpi4PLgvrczBVaNuHZJ3A5DYbUrzc8W0 VpZu4d/NqUdheDLqaWYcdHe9nLandshePQ6+STfQX1wTHKIuPXl0jyS7gnfjvCvAOo5O Q98g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=XdEhO1lY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si1668681edb.517.2020.08.05.11.21.34; Wed, 05 Aug 2020 11:22:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=XdEhO1lY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbgHESVS (ORCPT + 99 others); Wed, 5 Aug 2020 14:21:18 -0400 Received: from m15114.mail.126.com ([220.181.15.114]:43466 "EHLO m15114.mail.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729115AbgHESNh (ORCPT ); Wed, 5 Aug 2020 14:13:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=QTs20Y2uQb75JxoibU 08BQmlRKaNqO3ksWubKbOLAMk=; b=XdEhO1lYn70aHJn7bKkRt5gQFR/zOndikH dnrY/5tS8TJBqf9VAde3cKoSDLEvLpG2QoYTEfmDpJnSOymC7FfHdKzJU3bmYTC1 FVefq/mXxXuqR1p9+4SoFxen0bHthfSqJ/4Nf0mtcSprnTcNwnSxd4GuWRoMKY35 /2fGAmJjQ= Received: from 192.168.137.129 (unknown [112.10.84.202]) by smtp7 (Coremail) with SMTP id DsmowADXTEK3tSpfUXVBIA--.57772S3; Wed, 05 Aug 2020 21:35:53 +0800 (CST) From: Xianting Tian To: bcrl@kvack.org, viro@zeniv.linux.org.uk Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] aio: use wait_for_completion_io() when waiting for completion of io Date: Wed, 5 Aug 2020 09:35:51 -0400 Message-Id: <1596634551-27526-1-git-send-email-xianting_tian@126.com> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: DsmowADXTEK3tSpfUXVBIA--.57772S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrur1xKF48Ww1rtF1DCw4rKrg_yoWkCrc_Gr 18tF18uayUXFWDKw1jkrZ3t3s0939rC3Z5WanxWF97Gay3GasxCr1Dtwn0vFySg342qF15 Wws8CFW7trnrCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0loGPUUUUU== X-Originating-IP: [112.10.84.202] X-CM-SenderInfo: h0ld03plqjs3xldqqiyswou0bp/1tbi5hl3pFpD-Dx3VQAAsX Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When waiting for the completion of io, we need account iowait time. As wait_for_completion() calls schedule_timeout(), which doesn't account iowait time. While wait_for_completion_io() calls io_schedule_timeout(), which will account iowait time. So using wait_for_completion_io() instead of wait_for_completion() when waiting for completion of io before exit_aio and io_destroy. Signed-off-by: Xianting Tian --- fs/aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 91e7cc4..498b8a0 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -892,7 +892,7 @@ void exit_aio(struct mm_struct *mm) if (!atomic_sub_and_test(skipped, &wait.count)) { /* Wait until all IO for the context are done. */ - wait_for_completion(&wait.comp); + wait_for_completion_io(&wait.comp); } RCU_INIT_POINTER(mm->ioctx_table, NULL); @@ -1400,7 +1400,7 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr, * is destroyed. */ if (!ret) - wait_for_completion(&wait.comp); + wait_for_completion_io(&wait.comp); return ret; } -- 1.8.3.1