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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37FA6C433EF for ; Thu, 23 Jun 2022 18:14:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A0B318E017B; Thu, 23 Jun 2022 14:14:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96B768E0144; Thu, 23 Jun 2022 14:14:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85A7E8E017B; Thu, 23 Jun 2022 14:14:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 774458E0144 for ; Thu, 23 Jun 2022 14:14:49 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3EEBB34815 for ; Thu, 23 Jun 2022 18:14:49 +0000 (UTC) X-FDA: 79610301498.07.B53350D Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by imf14.hostedemail.com (Postfix) with ESMTP id BC0BF10001D for ; Thu, 23 Jun 2022 18:14:48 +0000 (UTC) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25NHumEG031516 for ; Thu, 23 Jun 2022 11:14:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=YK7eG3j7NHy9n91qx9y5OPEq/Sc1sG64s/rjfArr8jQ=; b=JzMhRhJtiMvYgqi594MJOXivAVIlgaGWjaSMWepCRKvxuhi0qnGD4+22CMtAmQzUzOWo d83y/Gsf78FgdP0iA2of+K9UdZ80CFRqWxTotw62n/G7W7uv+Mw+cwat/oeX8cO8E1aC IWVjDAji9ai9uhfQq80hQ+DNX6URS8epmvQ= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3gvvmj89tb-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 23 Jun 2022 11:14:22 -0700 Received: from twshared5640.09.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 23 Jun 2022 11:14:15 -0700 Received: by devvm225.atn0.facebook.com (Postfix, from userid 425415) id 9CEDF10C5DC6A; Thu, 23 Jun 2022 10:52:00 -0700 (PDT) From: Stefan Roesch To: , , , , CC: , , , , , Subject: [RESEND PATCH v9 12/14] io_uring: Add tracepoint for short writes Date: Thu, 23 Jun 2022 10:51:55 -0700 Message-ID: <20220623175157.1715274-13-shr@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220623175157.1715274-1-shr@fb.com> References: <20220623175157.1715274-1-shr@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: ui5V4Uinj4VMuqnfTyWV95ORtcyq0AO4 X-Proofpoint-GUID: ui5V4Uinj4VMuqnfTyWV95ORtcyq0AO4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-23_07,2022-06-23_01,2022-06-22_01 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656008088; a=rsa-sha256; cv=none; b=mhm4VbHNUMNcTyJxACdGifdR5M/NH8k3EOs+C4/DMzY7erwa5mT1xs92JSP3hopatpBfii r91Y+Tz7SIqyC0IIgCB52uTj2dRROeY0/wrdpRcr2hIeaVRuyM5DaWuvoNGeehjN8/ma2j VQIFtfLlVy57KAdpgiDEeRRaSihbzXQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=JzMhRhJt; dmarc=pass (policy=reject) header.from=fb.com; spf=none (imf14.hostedemail.com: domain of "prvs=71737354e2=shr@fb.com" has no SPF policy when checking 67.231.145.42) smtp.mailfrom="prvs=71737354e2=shr@fb.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656008088; h=from:from:sender: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:dkim-signature; bh=YK7eG3j7NHy9n91qx9y5OPEq/Sc1sG64s/rjfArr8jQ=; b=6ZH5YJBm9zjsKs58+om6A2UFiveThOJmJgkSSa3xUyAREk3dbtfJj74viWZdKCKdmJFc3P CKu36he/S191Z7zEbKEvp79zrGX7yw7n5ZlVJ7LpZB+/8MuCPDSEAP0I6+xev5CH9LF/Qn cq0UHigVc4OQV9FcdE8VL+otcW8tKtM= X-Stat-Signature: nqrw5gqp8451t88m1s4jk4c49hn6w74h X-Rspamd-Queue-Id: BC0BF10001D Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=JzMhRhJt; dmarc=pass (policy=reject) header.from=fb.com; spf=none (imf14.hostedemail.com: domain of "prvs=71737354e2=shr@fb.com" has no SPF policy when checking 67.231.145.42) smtp.mailfrom="prvs=71737354e2=shr@fb.com" X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1656008088-143193 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This adds the io_uring_short_write tracepoint to io_uring. A short write is issued if not all pages that are required for a write are in the page cache and the async buffered writes have to return EAGAIN. Signed-off-by: Stefan Roesch --- fs/io_uring.c | 3 +++ include/trace/events/io_uring.h | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 22a0bb8c5fe5..510c09192832 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4597,6 +4597,9 @@ static int io_write(struct io_kiocb *req, unsigned = int issue_flags) if (ret2 !=3D req->cqe.res && ret2 >=3D 0 && need_complete_io(req)) { struct io_async_rw *rw; =20 + trace_io_uring_short_write(req->ctx, kiocb->ki_pos - ret2, + req->cqe.res, ret2); + /* This is a partial write. The file pos has already been * updated, setup the async struct to complete the request * in the worker. Also update bytes_done to account for diff --git a/include/trace/events/io_uring.h b/include/trace/events/io_ur= ing.h index 66fcc5a1a5b1..25df513660cc 100644 --- a/include/trace/events/io_uring.h +++ b/include/trace/events/io_uring.h @@ -600,6 +600,31 @@ TRACE_EVENT(io_uring_cqe_overflow, __entry->cflags, __entry->ocqe) ); =20 +TRACE_EVENT(io_uring_short_write, + + TP_PROTO(void *ctx, u64 fpos, u64 wanted, u64 got), + + TP_ARGS(ctx, fpos, wanted, got), + + TP_STRUCT__entry( + __field(void *, ctx) + __field(u64, fpos) + __field(u64, wanted) + __field(u64, got) + ), + + TP_fast_assign( + __entry->ctx =3D ctx; + __entry->fpos =3D fpos; + __entry->wanted =3D wanted; + __entry->got =3D got; + ), + + TP_printk("ring %p, fpos %lld, wanted %lld, got %lld", + __entry->ctx, __entry->fpos, + __entry->wanted, __entry->got) +); + #endif /* _TRACE_IO_URING_H */ =20 /* This part must be outside protection */ --=20 2.30.2