Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp953629pxb; Wed, 6 Apr 2022 05:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh5Mqsof5L6dHRVYAUzeu7TG6MeZgXRjqqKCl/r4fUQmBLeYiofDdcD6mfmUnKV4UhcjE8 X-Received: by 2002:a63:bf0e:0:b0:386:361f:e97a with SMTP id v14-20020a63bf0e000000b00386361fe97amr6716096pgf.552.1649247173022; Wed, 06 Apr 2022 05:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247173; cv=none; d=google.com; s=arc-20160816; b=IVu+QLxUjwKF0iak9+b/3BlFsGIja2l2KxfhsgYY0I7w406wpsuU52HJ/c+aKoPaLv 98fa3ZaqfSVGEKBUXzwELweS465tsyuLecTcGN7YM94Q8ciY6DVReFWiuStjybM9z3Vk rOYQSqNawn1qQxCFCRpxdbfNO16wvrJPD3il3Ar5jYVk4J7AlOPT7bePX8B70Itq08pc vRYU03DuRfdsSGWgC/ZbdEm1aj9v/P5swnC5O8VvTeAgf+99jqyVLzGQXCayUjBWl79i Reom7+LES6S/9o6YOLM2yPZ0qka/fMWDc0RFBNMOneFDbxR/GUdgv0h/2s/5vdCPrC5B NnEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=gJkxDXSEYt1EkEAoQkgga/R4Mupd8VA+FogHO8b0lV4=; b=QbNEdzqN63n86zI90N8WVlHAqmbEvlU0EMxdVutY7QdIu4r3QXapLxrAhuxgPXf2r+ Lq3dLyfXSskM5OpU/7RW6lg9POAowKC2GeVstM6AyndoBghVQ3KLa4n5WsUaR76FT6am OdVOjDMCkcSlkWK3xKufnWJSPtlPO3oWNB9ydfEGy39NJZGEmKw9eB7ZCkGhl/Jwf7K9 E6IVv6w+Dp47cRk9VTK3WBX1vB3aE0ePw0qOa6J7JfG2F/63xFHi1bsQCLcs+RaPcIyQ taWiIVrwGw0PW5twCBkdkeEKTNE/bjvE7PsFTGIjxKCgQGSqJoHLNsEzm+PO0yaUlJMU FiYA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y6-20020a17090ad0c600b001cabc1752c8si4665840pjw.82.2022.04.06.05.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:12:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7F3956AC75F; Wed, 6 Apr 2022 03:50:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445810AbiDFDes (ORCPT + 99 others); Tue, 5 Apr 2022 23:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2359565AbiDFDPy (ORCPT ); Tue, 5 Apr 2022 23:15:54 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71731DD960 for ; Tue, 5 Apr 2022 17:01:58 -0700 (PDT) Received: from dread.disaster.area (pa49-180-43-123.pa.nsw.optusnet.com.au [49.180.43.123]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 555F010E56E5; Wed, 6 Apr 2022 10:01:32 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1nbt74-00EFQJ-N4; Wed, 06 Apr 2022 10:01:30 +1000 Date: Wed, 6 Apr 2022 10:01:30 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Yang Shi , Roman Gushchin , Hillf Danton , MM , Mel Gorman , Stephen Brennan , Yu Zhao , David Hildenbrand , LKML Subject: Re: [RFC] mm/vmscan: add periodic slab shrinker Message-ID: <20220406000130.GZ1609613@dread.disaster.area> References: <20220402072103.5140-1-hdanton@sina.com> <20220403005618.5263-1-hdanton@sina.com> <20220404010948.GV1609613@dread.disaster.area> <20220405051710.GW1609613@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=deDjYVbe c=1 sm=1 tr=0 ts=624cd85d a=MV6E7+DvwtTitA3W+3A2Lw==:117 a=MV6E7+DvwtTitA3W+3A2Lw==:17 a=kj9zAlcOel0A:10 a=z0gMJWrwH1QA:10 a=7-415B0cAAAA:8 a=GuXcQiCdMdAWui93_OgA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 05, 2022 at 10:21:53PM +0100, Matthew Wilcox wrote: > On Tue, Apr 05, 2022 at 01:58:59PM -0700, Yang Shi wrote: > > Yeah, I agree it actually doesn't make too much sense to return the > > number of reclaimed objects. Other part of vmscan returns the number > > of base pages, the sizes of slab objects are varied, it may be much > > smaller than a page, for example, dentry may be 192 bytes. > > From the point of view of vmscan, it only cares about the number of pages > freed because it's trying to free pages. But from the point of view of > trying to keep the number of non-useful objects in check, the number of > objects freed is more important, and it doesn't matter whether we ended > up freeing any pages because we made memory available for this slab cache. Yes and no. If the memory pressure is being placed on this cache, then freeing any number of objects is a win-win situation - reclaim makes progress and new allocations don't need to wait for reclaim. However, if there is no pressure on this slab cache, then freeing objects but no actual memory pages is largely wasted reclaim effort. Freeing those objects does nothing to alleviate the memory shortage, and the memory freed is not going to be consumed any time soon so all we've done is fragment the slab cache and require the subsystem to spend more resources re-populating it. That's a lose-lose. We want to select the shrinkers that will result in the former occurring, not the latter. Cheers, Dave. -- Dave Chinner david@fromorbit.com