Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1152694pxb; Thu, 4 Mar 2021 04:52:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvg8yvpXRanwnzTqEeChplGxrE1KOx3u/tFDJbDZUGMpfsIaJdOsNYe94rGPWq5a4bj9kk X-Received: by 2002:a17:906:544b:: with SMTP id d11mr4171622ejp.167.1614862355020; Thu, 04 Mar 2021 04:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614862355; cv=none; d=google.com; s=arc-20160816; b=h+TcfNQ5hD7yEmJMM0mrWRxZJ+ebtQDm0GagHciZ5/aYBAXhhNSzKHIGcKGnBNpg8c dMkkCxSyBjuyVisN29Vg9PxR+haqHae5yWJ10MV/upJcM2YUuUWk588CETx3BMCD5ai6 C//fveNCb9mvSpUMNvmx8Td9YxwolVtY96kC3lyv7q2jnntHW/E/ivENrslRRum0RYCO 9BnksWTsTy7ptfXO8rdzP7EWtmaxn9V0GzXAY8Ynv6shylS5Evd4Ci24kCx/tC2KGY2+ 2q+DbQ+mZyMeVHdQFjdKPT1xhkTN21eEzdEs8opx1ZDnbj5HOalnI/T3svX991NvMbUB wiSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gndyAcqrFEb63lWZfXawPqTaD/MPoQSVtS2l/6X7nOE=; b=uRETYKDo+NVhBR6UdNZQHUqXsTh5bwi5cF0e/onbTd8ToYe8lUiWi8c7LM1MR3SS2g NTli1Rh2oHEzhVaIopBb0wz0v82nxWCOk2vgqwnBfavaqCupoFYJhQjXBwqN7Yr7kNz1 NqYCPis80cUyd9s3iGrjaIUbGglh5XfdCnq137XoAZQugFXZdDoYDsiEMoPurd74MaBg 1KM3jYbRg2OOMwD6fjujPC0WYyr8nzfjlXVPASNKHkBiV5bEcyWtAmyX1Ou9ur6vpIZg 0K7zvie1iAz/wv6v5VOLvfsM7QltTvIHrLtBuAa+M0/ZUHYZz4Dpv96FGinLVcoCa0Pd hjPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Hy0MCL/p"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm7si9558972edb.188.2021.03.04.04.52.12; Thu, 04 Mar 2021 04:52:35 -0800 (PST) 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=pass header.i=@infradead.org header.s=casper.20170209 header.b="Hy0MCL/p"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239324AbhCDACm (ORCPT + 99 others); Wed, 3 Mar 2021 19:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387997AbhCCURv (ORCPT ); Wed, 3 Mar 2021 15:17:51 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABD1C061756 for ; Wed, 3 Mar 2021 12:17:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gndyAcqrFEb63lWZfXawPqTaD/MPoQSVtS2l/6X7nOE=; b=Hy0MCL/pcPG630Jq37Pi6sfRtV 0ZAZLuuOX51OLePqKr3e/vp3gLmwNjaSSyjBhstskI8wB2Xz9gAbeuYufynBjW8nKF2dWyA42V0/K EZOokb4u7ILkr0zMR0LTKoqMo9iFxSe4A0VVeHFTGuhUTKu96Z8uzBtGfOftzb4EI5Lm8AtF2OIob nnqQYbFhHVoiNEVnhdMxgKaXkZ/NnyIclhMEny94+NY67y/7QczxPlh6+e2/iimRss70Po2CrPDef jJSC41+VTZjuCmP7RPwpxxIv2elYgG565Q0CV0hkbg3DsJktqi+9PzTcoYaNzZ/lPHpEiBRClJLhn /BEY3sVA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lHXvN-0043UN-GD; Wed, 03 Mar 2021 20:16:52 +0000 Date: Wed, 3 Mar 2021 20:16:49 +0000 From: Matthew Wilcox To: Christoph Lameter Cc: Xunlei Pang , Vlastimil Babka , Wen Yang , Roman Gushchin , Pekka Enberg , Konstantin Khlebnikov , David Rientjes , linux-kernel@vger.kernel.org, "linux-mm@kvack.org" Subject: Re: [PATCH v2 3/3] mm/slub: Use percpu partial free counter Message-ID: <20210303201649.GF2723601@casper.infradead.org> References: <1597061872-58724-1-git-send-email-xlpang@linux.alibaba.com> <1597061872-58724-4-git-send-email-xlpang@linux.alibaba.com> <20210303142612.GC2723601@casper.infradead.org> <20210303193038.GE2723601@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 03, 2021 at 08:55:48PM +0100, Christoph Lameter wrote: > On Wed, 3 Mar 2021, Matthew Wilcox wrote: > > > > Can this be allocated in an interrupt context? > > > > > > And I am not sure how local_t relates to that? Percpu counters can be used > > > in an interrupt context without the overhead of the address calculations > > > that are required by a local_t. > > > > As I understand the patch, this counts the number of partially free slabs. > > So if we start to free an object from a completely full slab in process > > context, as "load x, add one to x, store x" and take an interrupt > > between loading x and adding one to x, that interrupt handler might > > free a different object from another completely full slab. that would > > also load the same x, add one to it and store x, but then the process > > context would add one to the old x, overwriting the updated value from > > interrupt context. > > this_cpu operations are "atomic" vs. preemption but on some platforms not > vs interrupts. That could be an issue in kmem_cache_free(). This would > need a modification to the relevant this_cpu ops so that interrupts are > disabled on those platforms. Hmmmm ... re-reading the documentation, it says that this_cpu_x is atomic against interrupts: These operations can be used without worrying about preemption and interrupts:: [...] this_cpu_add(pcp, val) this_cpu_inc(pcp) ...