Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp40764ybx; Mon, 4 Nov 2019 15:27:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxtTf/Z9YUOeR6FFv5uR4Pk7xwrJCdBGqsHQeyowFXyJs76yHcMoklTuclS3n+EoccD2WTN X-Received: by 2002:a17:906:1be9:: with SMTP id t9mr26344816ejg.10.1572910053857; Mon, 04 Nov 2019 15:27:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572910053; cv=none; d=google.com; s=arc-20160816; b=Pi4XGayi3jB/o6cCDIVAADZUsutzZAUulMFS+sDYNyVCVjE3tRtZ3fV/qt1PuyGY/k M35Eesr8/vCvMvuzXqDA+Ik3O3rC3P16NSXqXcbrgb5tua9eTrSGRdC6fIOp6JfHXC1x l+Bv3FYa9OSEotOJ4hNYXKdCeujOW4dVbpl102rlGkLcAlC9hSegOd0VqYX5IXQCBgAd xSz7lyyggn9qKp4DYhdgsv+8zMGiHxCsUtuFmWFhVCJPt/NSSp8g3tI6Fix3Mw1sUSn2 rLr4Y6MpWFrXMNmM1GqdSqASdKZdS3/Bdo0NC8tFQ1/USzJM+Bp/EEBZQDLPwEDyJAMg mvAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cMrpcm51otgeL8Re+g3qAXBEuLWi0XsR5qH01HB4h+U=; b=J58tr1t0racWGqcP1vy8imm8gJG78SnnwElyeKa9fFZ4/NhcLl4oEq2qesPjbW3rm4 1/YIGXFeKofkuUJO8jVDhFwU4Mn14sHUT254FttVKtSHfw9l2qYMaW2xtFXt0KYWOUai Mo93/UbcLr+La7hG4/iOZ+p77WkY9uujlji5BO2vwPwlZ3MIP7tBdFlxGdTJOLsmAkUr P3hCSM94GAfoknH/682d5UQ5FY0LA2KX110kI/kJBHev2n8iIpwvdbZuj5O6ZiUcc1Zl wvVV4vMdt6v99T3Tb+4Gl+CTKdPZr9y/v3ThJXQduZLpGCJwUmV7VTzpPazwZXLF/Bt1 ejCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=XVxuk3+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i30si9340702edd.124.2019.11.04.15.27.09; Mon, 04 Nov 2019 15:27:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=XVxuk3+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730164AbfKDXVS (ORCPT + 99 others); Mon, 4 Nov 2019 18:21:18 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:46588 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729428AbfKDXVR (ORCPT ); Mon, 4 Nov 2019 18:21:17 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xA4NJYTA045505; Mon, 4 Nov 2019 23:21:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=cMrpcm51otgeL8Re+g3qAXBEuLWi0XsR5qH01HB4h+U=; b=XVxuk3+VkgptV3dSxv2tl03MO7LxC14L6bl/oJDyrVamwZjGvtogHsnOVfHw0FbHieqg JAB1nttbJCoh7zAF90B4zlj6MpADbK2JevENtY0Ad+JsnQLWGDv+SMGGMaflEBOYe5S3 chzygh9kvnrEth7oTt5sDYGFJsJLd/YckOB8OnD3UV1FV7kLQSJhL0jxJkLHTkwg6GJR tpIgNTakvi6HnWH88pka1TjZ4gxvDfflEDqKqrWMZmm5H8vY6JMDyLw+yk0QJi6SScoe +z6NSS+eiu8+nzIXkT/PmJJogzqtCP/1TLcz+DM55UkxFGgjs8fvSJTzPM+hmriGfD5X fQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2w12er2fsr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Nov 2019 23:21:13 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xA4NJVC0102226; Mon, 4 Nov 2019 23:21:12 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2w1kxn7qv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Nov 2019 23:21:12 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id xA4NLCTF020486; Mon, 4 Nov 2019 23:21:12 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Nov 2019 15:21:11 -0800 Date: Mon, 4 Nov 2019 15:21:10 -0800 From: "Darrick J. Wong" To: Dave Chinner Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/28] xfs: Improve metadata buffer reclaim accountability Message-ID: <20191104232110.GS4153244@magnolia> References: <20191031234618.15403-1-david@fromorbit.com> <20191031234618.15403-5-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191031234618.15403-5-david@fromorbit.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9431 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=836 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911040221 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9431 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=921 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911040222 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 01, 2019 at 10:45:54AM +1100, Dave Chinner wrote: > From: Dave Chinner > > The buffer cache shrinker frees more than just the xfs_buf slab > objects - it also frees the pages attached to the buffers. Make sure > the memory reclaim code accounts for this memory being freed > correctly, similar to how the inode shrinker accounts for pages > freed from the page cache due to mapping invalidation. > > We also need to make sure that the mm subsystem knows these are > reclaimable objects. We provide the memory reclaim subsystem with a > a shrinker to reclaim xfs_bufs, so we should really mark the slab > that way. > > We also have a lot of xfs_bufs in a busy system, spread them around > like we do inodes. > > Signed-off-by: Dave Chinner > --- > fs/xfs/xfs_buf.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index 1e63dd3d1257..d34e5d2edacd 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -324,6 +324,9 @@ xfs_buf_free( > > __free_page(page); > } > + if (current->reclaim_state) > + current->reclaim_state->reclaimed_slab += > + bp->b_page_count; > } else if (bp->b_flags & _XBF_KMEM) > kmem_free(bp->b_addr); > _xfs_buf_free_pages(bp); > @@ -2061,7 +2064,8 @@ int __init > xfs_buf_init(void) > { > xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", > - KM_ZONE_HWALIGN, NULL); > + KM_ZONE_HWALIGN | KM_ZONE_SPREAD | KM_ZONE_RECLAIM, As discussed on the previous iteration of this series, I'd like to capture the reasons for adding KM_ZONE_SPREAD as a separate patch. --D > + NULL); > if (!xfs_buf_zone) > goto out; > > -- > 2.24.0.rc0 >