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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 4D6A2C54FD0 for ; Wed, 25 Mar 2020 04:42:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2633C20719 for ; Wed, 25 Mar 2020 04:42:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iMn0vibT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725832AbgCYEmm (ORCPT ); Wed, 25 Mar 2020 00:42:42 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:40024 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725263AbgCYEmm (ORCPT ); Wed, 25 Mar 2020 00:42:42 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02P4d9Fb067095; Wed, 25 Mar 2020 04:42:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=WW1UvjZgD5XVHfZJpknuEQ8SvY4os2SHVrcfVCnxPwc=; b=iMn0vibTNTGTz1xR6kL8Ooe+UocAYzhp/jhxhs3fqFl+pItU2aZgIpoUYtlxPpDUjbix LOv7D5j+F3yFLQySLnYvAms4lGDT2JJVWA3SQjiRgre+A8oP3IndFIHnS4hYuWAk1XaD P8/sMmiUC4XRt8lKM+LY8oHcstbznU3JZqiW0E7pNILI9SGupGdTGtYdcC9naP0f76y+ JFDbDUNAa/bgHrBYeidwx9fOuzqIPHhlWeLsypBEin+HTjlyN7KXPpOLcgeZnBysK2I3 P/d/DXnE+VDhs75Qrz79cQx86xenFgamzSHzEV3mHgJYkYTpLrBqw770M13AeLJwqkVC gA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2ywavm7r79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 04:42:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02P4RZAq163936; Wed, 25 Mar 2020 04:42:39 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2yxw6p3n6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 04:42:39 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 02P4gcar005569; Wed, 25 Mar 2020 04:42:38 GMT Received: from [192.168.1.223] (/67.1.1.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Mar 2020 21:42:38 -0700 Subject: Re: [PATCH 3/8] xfs: don't allow log IO to be throttled To: Dave Chinner , linux-xfs@vger.kernel.org References: <20200325014205.11843-1-david@fromorbit.com> <20200325014205.11843-4-david@fromorbit.com> From: Allison Collins Message-ID: <74940e62-8f96-a301-38dd-a151e86684df@oracle.com> Date: Tue, 24 Mar 2020 21:42:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200325014205.11843-4-david@fromorbit.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9570 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003250038 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9570 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 bulkscore=0 clxscore=1015 impostorscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003250038 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On 3/24/20 6:42 PM, Dave Chinner wrote: > From: Dave Chinner > > Running metadata intensive workloads, I've been seeing the AIL > pushing getting stuck on pinned buffers and triggering log forces. > The log force is taking a long time to run because the log IO is > getting throttled by wbt_wait() - the block layer writeback > throttle. It's being throttled because there is a huge amount of > metadata writeback going on which is filling the request queue. > > IOWs, we have a priority inversion problem here. > > Mark the log IO bios with REQ_IDLE so they don't get throttled > by the block layer writeback throttle. When we are forcing the CIL, > we are likely to need to to tens of log IOs, and they are issued as > fast as they can be build and IO completed. Hence REQ_IDLE is > appropriate - it's an indication that more IO will follow shortly. > > And because we also set REQ_SYNC, the writeback throttle will now > treat log IO the same way it treats direct IO writes - it will not > throttle them at all. Hence we solve the priority inversion problem > caused by the writeback throttle being unable to distinguish between > high priority log IO and background metadata writeback. > > Signed-off-by: Dave Chinner > Reviewed-by: Brian Foster > Reviewed-by: Christoph Hellwig > Reviewed-by: Darrick J. Wong Looks ok Reviewed-by: Allison Collins > --- > fs/xfs/xfs_log.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c > index f70be8151a59f..e16ad0b1aec84 100644 > --- a/fs/xfs/xfs_log.c > +++ b/fs/xfs/xfs_log.c > @@ -1687,7 +1687,15 @@ xlog_write_iclog( > iclog->ic_bio.bi_iter.bi_sector = log->l_logBBstart + bno; > iclog->ic_bio.bi_end_io = xlog_bio_end_io; > iclog->ic_bio.bi_private = iclog; > - iclog->ic_bio.bi_opf = REQ_OP_WRITE | REQ_META | REQ_SYNC | REQ_FUA; > + > + /* > + * We use REQ_SYNC | REQ_IDLE here to tell the block layer the are more > + * IOs coming immediately after this one. This prevents the block layer > + * writeback throttle from throttling log writes behind background > + * metadata writeback and causing priority inversions. > + */ > + iclog->ic_bio.bi_opf = REQ_OP_WRITE | REQ_META | REQ_SYNC | > + REQ_IDLE | REQ_FUA; > if (need_flush) > iclog->ic_bio.bi_opf |= REQ_PREFLUSH; > >