From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935933AbcHBRlK (ORCPT ); Tue, 2 Aug 2016 13:41:10 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:21598 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935426AbcHBRjq (ORCPT ); Tue, 2 Aug 2016 13:39:46 -0400 Subject: Re: [PATCH] mm/slab: Improve performance of gathering slabinfo stats To: Christoph Lameter , Joonsoo Kim References: <1470096548-15095-1-git-send-email-aruna.ramakrishna@oracle.com> <20160802005514.GA14725@js1304-P5Q-DELUXE> <4a3fe3bc-eb1d-ea18-bd70-98b8b9c6a7d7@oracle.com> <20160802024342.GA15062@js1304-P5Q-DELUXE> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Kravetz , Pekka Enberg , David Rientjes , Andrew Morton From: Aruna Ramakrishna Message-ID: <39e8a2e9-93c9-9051-cd90-3690baa8239f@oracle.com> Date: Tue, 2 Aug 2016 10:39:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/2016 07:59 AM, Christoph Lameter wrote: > Hmm.... What SLUB does is: > > 1. Keep a count of the total number of allocated slab pages per node. > This counter only needs to be updated when a slab page is > allocated from the page allocator or when it is freed to the > page allocator. At that point we already hold the per node lock, > page allocator operations are extremely costly anyways and so that > is ok. > > 2. Keep a count of the number of partially allocated slab pages per node. > At that point we have to access the partial list and take a per > node lock. Placing the counter into the same cacheline and > the increment/decrement into the period when the lock has been taken > avoids the overhead. > As Joonsoo mentioned in his previous comment, the partial list is pretty small anyway. And we cannot avoid traversal of the partial list - we have to count the number of active objects in each partial slab: active_objs += page->active; So keeping a count of partially allocated slabs seems unnecessary to me. > The number of full pages is then > > total - partial > > > If both allocators would use the same scheme here then the code to > maintain the counter can be moved into mm/slab_common.c. Plus the per node > structures could be mostly harmonized between both allocators. Maybe even > the page allocator operations could become common code. > > Aruna: Could you work on a solution like that? > Yup, I'll replace the 3 counters with one counter for number of slabs per node and send out a new patch. I'll try to make the counter management as similar as possible, between SLAB and SLUB. Thanks, Aruna