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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 3B315C4BA35 for ; Thu, 27 Feb 2020 01:47:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E77A8208E4 for ; Thu, 27 Feb 2020 01:47:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="pGINgofb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E77A8208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9569D6B0003; Wed, 26 Feb 2020 20:47:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E0536B0005; Wed, 26 Feb 2020 20:47:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D0756B0006; Wed, 26 Feb 2020 20:47:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 599246B0003 for ; Wed, 26 Feb 2020 20:47:08 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 199F42C07 for ; Thu, 27 Feb 2020 01:47:08 +0000 (UTC) X-FDA: 76534218936.02.sheet27_40c49316cc5f X-HE-Tag: sheet27_40c49316cc5f X-Filterd-Recvd-Size: 3365 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Feb 2020 01:47:07 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C2BE24670; Thu, 27 Feb 2020 01:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582768026; bh=Fb3vftbPl8Pm/5IijpyzoUT41swYUgxzlby6KlIX51o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pGINgofb/+HgrulnVbBfvXR8zOwOKv38GoDmSIhSM4hjHChvMeEXzv14s+6WbCSke VzqpnHbJNfaPO9vDRz+SBc8JD9QJXbdh59yIzZiaRRhh1ELM1t9NMNAQtHLivQBM/t OfwXW4koMJW0jLwwUZUcjzUDKRXmO7r1wIusuiw0= Date: Wed, 26 Feb 2020 17:47:06 -0800 From: Andrew Morton To: Vlastimil Babka Cc: Christopher Lameter , qiwuchen55@gmail.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, chenqiwu Subject: Re: [PATCH v2] mm/slub.c: replace kmem_cache->cpu_partial with wrapped APIs Message-Id: <20200226174706.0840bbe70392f73264ffa6ec@linux-foundation.org> In-Reply-To: <182f5569-cda6-80b2-45fe-dd1f4ae66956@suse.cz> References: <1582079562-17980-1-git-send-email-qiwuchen55@gmail.com> <182f5569-cda6-80b2-45fe-dd1f4ae66956@suse.cz> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 26 Feb 2020 19:13:31 +0100 Vlastimil Babka wrote: > On 2/22/20 4:40 AM, Christopher Lameter wrote: > > On Wed, 19 Feb 2020, qiwuchen55@gmail.com wrote: > > > >> diff --git a/mm/slub.c b/mm/slub.c > >> index 17dc00e..1eb888c 100644 > >> --- a/mm/slub.c > >> +++ b/mm/slub.c > >> @@ -2284,7 +2284,7 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) > >> if (oldpage) { > >> pobjects = oldpage->pobjects; > >> pages = oldpage->pages; > >> - if (drain && pobjects > s->cpu_partial) { > >> + if (drain && pobjects > slub_cpu_partial(s)) { > >> unsigned long flags; > >> /* > >> * partial array is full. Move the existing > > > > Maybe its better to not generate code for put_cpu_partial() instead of > > using macros there if per cpu partials are disabled? > > The whole code of put_cpu_partial() is already under > #ifdef CONFIG_SLUB_CPU_PARTIAL. > > I agree that the wrapper shouldn't be used in a function that deals only with > the case that the partials do exist. It just obscures the code unnecessarily. Yes, I scratched my head over this and decided to go ahead with the patches. Given that we have an accessor for ->cpu_partial, it's best that it be used consistently. The fact that the wrapper is there to avoid ifdefs is an implementation detail which is private to the header files and Kconfig system. IOW, the way we open-code it in some places and use the accessor in other places also obscures the code. Which is preferable? I don't see a clear answer, but lean towards consistency.