Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp489632ybx; Fri, 1 Nov 2019 06:43:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7INs1D5Gvo7n2gX3PBgswBjqJyDMqdUQQSWaum9AdK+vpiYMXycNKqS0csSbGhRoB1U6S X-Received: by 2002:a05:6402:17ec:: with SMTP id t12mr12893050edy.37.1572615781258; Fri, 01 Nov 2019 06:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572615781; cv=none; d=google.com; s=arc-20160816; b=CdRZQ3ASZh0PdRTt5dxOyI83349cJlH65k5yQgobmE+TIcWUtWJAMzf+00rZ7Y/9Bq 7Lxg5tcrz0ogrjDCEpzBUQAFN3wNOZk55BRnFQtPJFIBNe/Z11QNzIGUGhMssMmLLXGU arDkcUP+tMb53MnOVBHsxpWwd7EOTk8ZchQaS4FF2CF4R3EkX7rC374cIIOWKyGtVoze 7CPbnkxdI0xWeUxNch+uH1HP4oa6OaafwJWMEruEVOEKV9rGLuD0b6k/WAL7ur3ecBMd 3mhqAYaOEUHJch5y8vzCTuclB+V3y44zPsWb1rHvqRo2tNTVHbjYA/srFtKnyn4P8bwg UYMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HGDftV3Cms7wFSvWoR03p6Dc2RRKcomCEzYNrgPl5Qc=; b=acyspRechn1nc+1//GnHkl9RfNB8jjk4TIghMVql5ehYouPiG+A3ybQ50gO5NFyhd4 yrcaHSdc74LYetN87kfZpZuCry6yNUg1Z/ibseoJGXtUrMI5T4q/cttii06UczfT7Tff VjZGg1XF9VtkQ6fMutN2qWRMEXNymYDw/KMc/gqdDwaqCSg1gmG114WgnL/8uQ+fkqL3 F4S77XzKRMh8zEAS8EiziI9yUXEj4yNDOxBVWYxFCLpQEKTA5wkpz7nD88hLmlZz3BOS 06MtKus4bBXcPsDggyy7ql+E7cVi2m3M26tuvLj6KMe9BYhmL6KwO2FUvpjm37gP0Sqx +EmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V+rma+Kv; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si380627edc.416.2019.11.01.06.42.16; Fri, 01 Nov 2019 06:43:01 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=V+rma+Kv; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730511AbfKAMFW (ORCPT + 99 others); Fri, 1 Nov 2019 08:05:22 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53241 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728645AbfKAMFV (ORCPT ); Fri, 1 Nov 2019 08:05:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572609920; h=from:from: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; bh=HGDftV3Cms7wFSvWoR03p6Dc2RRKcomCEzYNrgPl5Qc=; b=V+rma+KvUdWeZiBjw8BBlKjad99mqWyKTmzTVIjagSgeveLXiZ50+OljO72feZHbPiGwLo YyF8X+I3u/sVPOrVH6T6hbqBb/NDrTVzld5S5NlHfxB0P9Z5Hd4Vu/nesxImrPYbwQr/zC 4ySuJOjb27Yw7L3e9Gegn1U+B1X0orE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-UOBXAZjoOIywgB2hI5UtlA-1; Fri, 01 Nov 2019 08:05:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 151E62EDA; Fri, 1 Nov 2019 12:05:16 +0000 (UTC) Received: from bfoster (dhcp-41-2.bos.redhat.com [10.18.41.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77B7F1001B09; Fri, 1 Nov 2019 12:05:15 +0000 (UTC) Date: Fri, 1 Nov 2019 08:05:13 -0400 From: Brian Foster 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: <20191101120513.GD59146@bfoster> References: <20191031234618.15403-1-david@fromorbit.com> <20191031234618.15403-5-david@fromorbit.com> MIME-Version: 1.0 In-Reply-To: <20191031234618.15403-5-david@fromorbit.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: UOBXAZjoOIywgB2hI5UtlA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 >=20 > 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. >=20 > 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. >=20 > We also have a lot of xfs_bufs in a busy system, spread them around > like we do inodes. >=20 > Signed-off-by: Dave Chinner > --- I still don't see why we wouldn't set the spread flag on the bli cache as well, but afaict it doesn't matter in most cases unless the spread knob is enabled. Unless I'm misunderstanding how that works, I think the commit log could be improved to describe that since to me it implies the flag by itself has an effect, but otherwise the change seems fine: Reviewed-by: Brian Foster > fs/xfs/xfs_buf.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > 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( > =20 > =09=09=09__free_page(page); > =09=09} > +=09=09if (current->reclaim_state) > +=09=09=09current->reclaim_state->reclaimed_slab +=3D > +=09=09=09=09=09=09=09bp->b_page_count; > =09} else if (bp->b_flags & _XBF_KMEM) > =09=09kmem_free(bp->b_addr); > =09_xfs_buf_free_pages(bp); > @@ -2061,7 +2064,8 @@ int __init > xfs_buf_init(void) > { > =09xfs_buf_zone =3D kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", > -=09=09=09=09=09=09KM_ZONE_HWALIGN, NULL); > +=09=09=09KM_ZONE_HWALIGN | KM_ZONE_SPREAD | KM_ZONE_RECLAIM, > +=09=09=09NULL); > =09if (!xfs_buf_zone) > =09=09goto out; > =20 > --=20 > 2.24.0.rc0 >=20