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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 AD49AC4320A for ; Tue, 3 Aug 2021 14:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9146761037 for ; Tue, 3 Aug 2021 14:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236538AbhHCOY4 (ORCPT ); Tue, 3 Aug 2021 10:24:56 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7919 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236282AbhHCOYy (ORCPT ); Tue, 3 Aug 2021 10:24:54 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GfH8y65sNz83Th; Tue, 3 Aug 2021 22:20:50 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 3 Aug 2021 22:24:41 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 3 Aug 2021 22:24:40 +0800 Subject: Re: [PATCH] slub: fix unreclaimable slab stat for bulk free To: Shakeel Butt CC: Christoph Lameter , Pekka Enberg , "David Rientjes" , Vlastimil Babka , "Michal Hocko" , Roman Gushchin , Wang Hai , Muchun Song , Andrew Morton , Linux MM , LKML References: <20210728155354.3440560-1-shakeelb@google.com> <8c14efe2-69dc-6eab-3cd5-c042576770e7@huawei.com> From: Kefeng Wang Message-ID: <35a0b75a-f348-d21c-4ff4-fadba0c4db02@huawei.com> Date: Tue, 3 Aug 2021 22:24:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/7/29 22:03, Shakeel Butt wrote: > On Wed, Jul 28, 2021 at 11:52 PM Kefeng Wang wrote: >> >> On 2021/7/28 23:53, Shakeel Butt wrote: >>> SLUB uses page allocator for higher order allocations and update >>> unreclaimable slab stat for such allocations. At the moment, the bulk >>> free for SLUB does not share code with normal free code path for these >>> type of allocations and have missed the stat update. So, fix the stat >>> update by common code. The user visible impact of the bug is the >>> potential of inconsistent unreclaimable slab stat visible through >>> meminfo and vmstat. >>> >>> Fixes: 6a486c0ad4dc ("mm, sl[ou]b: improve memory accounting") >>> Signed-off-by: Shakeel Butt >>> --- >>> mm/slub.c | 22 ++++++++++++---------- >>> 1 file changed, 12 insertions(+), 10 deletions(-) >>> >>> diff --git a/mm/slub.c b/mm/slub.c >>> index 6dad2b6fda6f..03770291aa6b 100644 >>> --- a/mm/slub.c >>> +++ b/mm/slub.c >>> @@ -3238,6 +3238,16 @@ struct detached_freelist { >>> struct kmem_cache *s; >>> }; >>> >>> +static inline void free_nonslab_page(struct page *page) >>> +{ >>> + unsigned int order = compound_order(page); >>> + >>> + VM_BUG_ON_PAGE(!PageCompound(page), page); >> Could we add WARN_ON here, or we got nothing when CONFIG_DEBUG_VM is >> disabled. > I don't have a strong opinion on this. Please send a patch with > reasoning if you want WARN_ON_ONCE here. Ok, we met a BUG_ON(!PageCompound(page)) in kfree() twice in lts4.4, we are still debugging it. It's different to analyses due to no vmcore, and can't be reproduced. WARN_ON() here could help us to notice the issue. Also is there any experience or known fix/way to debug this kinds of issue? memory corruption? Any suggestion will be appreciated, thanks. > . >