Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp172651pxy; Wed, 21 Apr 2021 22:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRVk2YOu+o7f8VluFTFX/W2WFF1zemIrLXh9NmPeirwgizCapsKtklC/EQKUBruqWu7BLU X-Received: by 2002:a17:906:3ce9:: with SMTP id d9mr1470681ejh.172.1619069465725; Wed, 21 Apr 2021 22:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619069465; cv=none; d=google.com; s=arc-20160816; b=gev7Z8cPFZx/+RCsGm6cSzdVBmLs4oQ4si/QR0SjPawFM4/R3U/bmOpiA5EnIpdrsu iXen8tCmXmqFN76a3VOnnDJW1KxcBxctgdbOv6MpE2K/PnRR+qjI2kTYbRAUL1H8krxF J7l48bR7BwwvpQe0V1vKdePop1UR5AnO1Fc9fkG2pjRomA2vLNu5/EObnCQL8Xma2UiK fE9HKWQZRvuLcaVIfI5UkohuUHjBtcDCJrXKOM6HGOFU7jBj8NnwV44u3gqHhxnwLshg Z2UK+qMfx+zY5YDFwoe3Tm/vsaB1k6q6FdDwXVyq1/YhuVmFyiHtMFvxHyq86IOBva/x fgVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:cc:to:subject:from :dkim-signature; bh=bqxfK+ICkPqElZ+XBPs+YGuSjhGSZ+ehPejQMG/PDoM=; b=Yuir4L0SDhew3FwntZZY9Wm3jedJZE86oldNgmShNvQNm+fO64CwS2h8WG7cpWiqzh vivfePVSrJlBfj42QOlkSdJBfDfIoC5Wsz+pMHzFVr2iyLFeOfKfd+Qaa2MpEIm8cYou dibdWTsBhT+p43CqV6fC3/n9vQysXFk20wOaiZxkWDDbGzZL+NP7G4QWx5HfAa7mlx3m dH0GvR0H60hulPZ+SWJJCOT5CA82YT7lZ7NnqPhkYHjzptn0+tLzBAPyWijZP+MQOrTe qe8HpyT6BKfKEjxkdWaUmdcRpwuQTePqdLC1YTP0CDrDL0U3tSqVZ2VvZd13eedDAtwn nJqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@virtuozzo.com header.s=relay header.b=i1ReVZFM; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si1535729edd.384.2021.04.21.22.30.42; Wed, 21 Apr 2021 22:31:05 -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=fail header.i=@virtuozzo.com header.s=relay header.b=i1ReVZFM; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231835AbhDVFaJ (ORCPT + 99 others); Thu, 22 Apr 2021 01:30:09 -0400 Received: from relay.sw.ru ([185.231.240.75]:60940 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbhDVFaJ (ORCPT ); Thu, 22 Apr 2021 01:30:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=bqxfK+ICkPqElZ+XBPs+YGuSjhGSZ+ehPejQMG/PDoM=; b=i1ReVZFMoBYlhqGdU5M nblOp+/0k/vDiq0fzKWx4lHq3UVKQUAURfKMQ8gxQYOaGKNZCCEYVoNOQgeMk7awz9/2Y2d7BvL63 nIZ6E/LTD1TmhrDmDPxLRa9B01IizHdeq7maaOLD2u1ms8gB106frBMGJUJlSOepl150Y7RKcpQ= Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1lZRu8-0019OH-4o; Thu, 22 Apr 2021 08:29:32 +0300 From: Vasily Averin Subject: [PATCH] tools/cgroup/slabinfo.py: updated to work on current kernel To: Andrew Morton , Roman Gushchin , linux-kernel@vger.kernel.org Cc: Michal Hocko Message-ID: Date: Thu, 22 Apr 2021 08:29:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org slabinfo.py script does not work with actual kernel version. First, it was unable to recognise SLUB susbsytem, when I specified it manually, it was failed again with AttributeError: 'struct page' has no member 'obj_cgroups' ... and then again with File "tools/cgroup/memcg_slabinfo.py", line 221, in main memcg.kmem_caches.address_of_(), AttributeError: 'struct mem_cgroup' has no member 'kmem_caches' Signed-off-by: Vasily Averin --- tools/cgroup/memcg_slabinfo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/cgroup/memcg_slabinfo.py b/tools/cgroup/memcg_slabinfo.py index c4225ed..1600b17 100644 --- a/tools/cgroup/memcg_slabinfo.py +++ b/tools/cgroup/memcg_slabinfo.py @@ -128,9 +128,9 @@ OO_MASK = ((1 << OO_SHIFT) - 1) cfg['nr_nodes'] = prog['nr_online_nodes'].value_() - if prog.type('struct kmem_cache').members[1][1] == 'flags': + if prog.type('struct kmem_cache').members[1].name == 'flags': cfg['allocator'] = 'SLUB' - elif prog.type('struct kmem_cache').members[1][1] == 'batchcount': + elif prog.type('struct kmem_cache').members[1].name == 'batchcount': cfg['allocator'] = 'SLAB' else: err('Can\'t determine the slab allocator') @@ -193,7 +193,7 @@ OO_MASK = ((1 << OO_SHIFT) - 1) # look over all slab pages, belonging to non-root memcgs # and look for objects belonging to the given memory cgroup for page in for_each_slab_page(prog): - objcg_vec_raw = page.obj_cgroups.value_() + objcg_vec_raw = page.memcg_data.value_() if objcg_vec_raw == 0: continue cache = page.slab_cache @@ -202,7 +202,7 @@ OO_MASK = ((1 << OO_SHIFT) - 1) addr = cache.value_() caches[addr] = cache # clear the lowest bit to get the true obj_cgroups - objcg_vec = Object(prog, page.obj_cgroups.type_, + objcg_vec = Object(prog, 'struct obj_cgroup **', value=objcg_vec_raw & ~1) if addr not in stats: -- 1.8.3.1