Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5359324pxj; Tue, 22 Jun 2021 22:48:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2ScFzrDUhukBLtIUQfb+ypGdqYwqhnPIhDmHkebMtyax45rlVc5aOjb9s+y3kkCB5P5oH X-Received: by 2002:a02:c987:: with SMTP id b7mr7275145jap.129.1624427280047; Tue, 22 Jun 2021 22:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624427280; cv=none; d=google.com; s=arc-20160816; b=Hl/9U+N+uf/IFMdLxnanFnfxYDfm27M9YKvPEhsLlV20fQHhWSLTZ1IQ/5gge/Mm56 yA6zjkBP7ijOLDVvcLZeXNK6QGjAv3E1dN0j35f+tshl6SqXtnEEG8yuDME4g/guIAIL yMbiZ/DyGakltnpB2SpnikM1aRfyuh1GQY/oh/2kx93lxXD4l76InDpccGv+Pj/HMTTo CQRZXBhg00e3rZ6iLVvb/uh5fUTULxuV/HgPXprnaN7Pcb/N5yg5nCle/bQPAiODnZqZ 2uAvCBWDv1h7H9wgCKf3Qp2gSf0qGGmkEFqcd8S6FbUK/iqp3b2+LE6qrChUljvpc+kJ EDDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HJCJPM1T+JXjSw+98p9nEe1sEcMGGWaPNFa6+pVTHQc=; b=L+5gaBfrK3Q1aUmG1hQOr+3qW2vVR4nmxcSkvcw1LGizdnitBOVibvwCGuDMtikI1P I1/pubI8Gax6t9yWNhtOXDJiiEtEZXpvxm0lOAyDRUX7hdfeTscduVbl+1lTBvUOkcM4 o9gCWFOGFkpMmSBn47iOX+1SoUB1OuYK11jzVxmZmWz7GWySgDWyyvqo424+ZhH/dydh pmvr+RCbpEwqwi4THLjHk5MNUbho9DOCtfAi8m2ltCQ6XN6Lhviu+FQuw1tO/JnEhKML JWsax3sc4BpjoET5wf4Jx2F7KklvBFKJBCertKbklYIr1YMjMeTPda96b1H1qFnurk6+ 1/uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gKkAOFZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i204si8461812iof.28.2021.06.22.22.47.48; Tue, 22 Jun 2021 22:48:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gKkAOFZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229818AbhFWFtK (ORCPT + 99 others); Wed, 23 Jun 2021 01:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbhFWFtH (ORCPT ); Wed, 23 Jun 2021 01:49:07 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36178C061574 for ; Tue, 22 Jun 2021 22:46:50 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id r7so1206688qta.12 for ; Tue, 22 Jun 2021 22:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HJCJPM1T+JXjSw+98p9nEe1sEcMGGWaPNFa6+pVTHQc=; b=gKkAOFZSLlVRKZqWTrHI1yJ3jaHZ+WsJtJSI8tyzZJtCHqOSiI/pMI+m/JrZIM2KbU fVxxh8dkQpDPFwer2yJJsuTIUOn0zxzHFgHF6J6OrHQLD90Lrtbvc6xABVDCF66nagM8 Uu2MtQm1Icnl1hw/WBMvHE68Cmj+SiFPlGcXKxjdGFQc1ACn42OOUmB8GKJ5UWbxEVoB U6qb1EjhstbWxxkcDVcE378OTr3uqp/VMZDsljLsUPnOnqjhRWjOfZssQaRMP1R9g2fK oiWSkUylQ2fKPwLLbbl/fCc0bsV1NffW82CHJD9PJHr/q+xTJgwOkU03VGtQiXsArY+L UPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HJCJPM1T+JXjSw+98p9nEe1sEcMGGWaPNFa6+pVTHQc=; b=GudXwPzADZE/4dNIB+/hMDeHSXLdnqLB03YsuLfH4aaeHuWqEEs+2Ax9x3RLEUTTGb m23tEKzd/g29xzkXGSdmbJlhQNexkh2AF47Th67pHI5oAa+RqYiJltr1L/zWksiXuIOl J8mQHmnAgXxm2vVCJoRereeij3GhV4O6nXr0DYDcHqBCdyQNes7dtgS4KDGec3J4GLTC Y84uOmqEd2+35H119zKBqzmd7BXSFFWiZsmbjs9aWKSNrpt+VFRdm44+ATd5blM6Z02w X9MVs+NoA3+j6G+tfEp7sCzWv3PHtZBPPZCkKN5AbuYDI0Ix8L/VzUZfTlgn3cxeWrP0 E8iA== X-Gm-Message-State: AOAM533ULZJW+l/esc2FPnw/2dkmrPdYLmc/nPH38oCDj5gvvDomnnPZ p38c4yHfdl6xaCRrpnx7j63JxUy4Ol1s9UzcoWI= X-Received: by 2002:ac8:682:: with SMTP id f2mr2271909qth.55.1624427209362; Tue, 22 Jun 2021 22:46:49 -0700 (PDT) MIME-Version: 1.0 References: <1623137297-29685-1-git-send-email-huangzhaoyang@gmail.com> In-Reply-To: From: Zhaoyang Huang Date: Wed, 23 Jun 2021 13:46:37 +0800 Message-ID: Subject: Re: [PATCH] mm: zram: amend SLAB_RECLAIM_ACCOUNT on zspage_cachep To: Minchan Kim Cc: Andrew Morton , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML , Nitin Gupta , Sergey Senozhatsky Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 7:38 AM Minchan Kim wrote: > > On Mon, Jun 21, 2021 at 10:35:26AM +0800, Zhaoyang Huang wrote: > > On Sat, Jun 19, 2021 at 6:02 AM Minchan Kim wrote: > > > > > > On Tue, Jun 08, 2021 at 03:28:17PM +0800, Huangzhaoyang wrote: > > > > From: Zhaoyang Huang > > > > > > > > Zspage_cachep is found be merged with other kmem cache during test, which > > > > is not good for debug things(zs_pool->zspage_cachep present to be another > > > > kmem cache in memory dumpfile). It is also neccessary to do so as shrinker has > > > > > > It's not a only problem of zsmalloc because slab want to minimize > > > fragmentation so try to merge several objects if it's allowed. > > > So I don't think it's particular problem of zsmalloc. > > > I guess slub has some option maybe "nomerge" if you want it. > > > > > > > > > been registered for zspage. Amending this flag can help kernel to calculate > > > > SLAB_RECLAIMBLE correctly. > > > > > > > > Signed-off-by: Zhaoyang Huang > > > > --- > > > > mm/zsmalloc.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > > > > index 19b563b..0b0addd 100644 > > > > --- a/mm/zsmalloc.c > > > > +++ b/mm/zsmalloc.c > > > > @@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool) > > > > return 1; > > > > > > > > pool->zspage_cachep = kmem_cache_create("zspage", sizeof(struct zspage), > > > > - 0, 0, NULL); > > > > + 0, SLAB_RECLAIM_ACCOUNT, NULL); > > > > > > How does zspage become SLAB_RECLAIM_ACCOUNT? > > > > > > I took the flag as "cacheable" object. IOW, when the shrinker > > > ask to reclaim the object, it should reclaim(e.g., discarding) > > > those objects for reclaming. However, that's not the case > > > in zsmalloc. > > alloc_slab will take the allocated object into account as > > SLAB_RECLAIMABLE when this flag set on the kmem_cache > > My point is zspage_cachep is not an reclimable slab cache. > Please describe why you believe it's reclaimable slab. zspage registered slab shrinker via zs_register_shrinker, in which the zspage be freed to cache