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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 2BFA6C4743C for ; Wed, 23 Jun 2021 05:46:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B95A76108E for ; Wed, 23 Jun 2021 05:46:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B95A76108E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 87AF96B0011; Wed, 23 Jun 2021 01:46:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82B4A6B0036; Wed, 23 Jun 2021 01:46:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CB846B006C; Wed, 23 Jun 2021 01:46:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 30BBC6B0011 for ; Wed, 23 Jun 2021 01:46:50 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 567AD181CCC92 for ; Wed, 23 Jun 2021 05:46:50 +0000 (UTC) X-FDA: 78283904580.36.93B9448 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf07.hostedemail.com (Postfix) with ESMTP id 0FC23A00026D for ; Wed, 23 Jun 2021 05:46:49 +0000 (UTC) Received: by mail-qt1-f171.google.com with SMTP id t9so1226278qtw.7 for ; Tue, 22 Jun 2021 22:46:49 -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=mIWtkqED62Pwzunr8EM7gQC5ron7Jt92cSVDOURSpWK+w9iXYF00orzMs9KDenzrPe WbOz57BrewsYJCErF3CtTJ8hj/ucmZNeBGKjpcQ52IBqcN+dVXL8TeCx+l4Bf69dXp62 RlAvlQVnpU4OWFZyQK9GekFGRRSVhT6ffNRjgPWbuD3G7KSU7XU357Hff0jv4gdMTN5G 5bC8czz0Gy2qKuBJ1OuALNlKus5a01q9pkaDoHuwGcG/Qn5Kv0LZit3PR/EKbRnLZF0Q +nhq/OSoYtu4Dg8gd7GB2Z7mFrMShZ6m4Mvm/xYSzSFVkbQMXzC07lS5B0VukZ6Wdn0s lu1w== X-Gm-Message-State: AOAM532wo1YMlHw8zDSc3glZlmBjSQo8t4Ub+WCsPQHNrL8dl3STnYSX 5EoG9GvaU3a/j6vInwxVe6BmvyAinw3NEtG+bnM= X-Google-Smtp-Source: ABdhPJwe8yykHuEfrbZwWaQH6/EI7lURKWK3xJr1de6PjOlJBufA0sx/I2Rlg20i0ZbmTkWdFsRpfOPuQsthXCKRSQw= 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" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0FC23A00026D X-Stat-Signature: rihby9sqq7ti68ioi7ydn8kyypdp3p8i Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gKkAOFZS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-HE-Tag: 1624427209-146106 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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