Message ID | 20210609113903.1421-29-vbabka@suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=BPbg=LD=kvack.org=owner-linux-mm@kernel.org> 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 4FC23C48BCF for <linux-mm@archiver.kernel.org>; Wed, 9 Jun 2021 11:40:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 03E5A60FD8 for <linux-mm@archiver.kernel.org>; Wed, 9 Jun 2021 11:40:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03E5A60FD8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 753C96B009A; Wed, 9 Jun 2021 07:39:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CBB16B009E; Wed, 9 Jun 2021 07:39:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 382BE6B009D; Wed, 9 Jun 2021 07:39:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id D1BE46B0081 for <linux-mm@kvack.org>; Wed, 9 Jun 2021 07:39:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6CE70824999B for <linux-mm@kvack.org>; Wed, 9 Jun 2021 11:39:38 +0000 (UTC) X-FDA: 78233990436.25.E6CDC85 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf22.hostedemail.com (Postfix) with ESMTP id C080CC00CBD7 for <linux-mm@kvack.org>; Wed, 9 Jun 2021 11:39:33 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 269E3219EB; Wed, 9 Jun 2021 11:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623238777; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i+kXFJUxiAt8nF/gFOeGLQ15QjX96rJgGO1xp0O5Hkw=; b=EZ1sKebsm1bY5kIaC7UF9DQ1G7UTyLUSr9XMyF5zYN+EANnQpxhQm1tfdWkXRzv30znYUQ e2SXselrS/jgk97AcPczw3+LhCZJhHsIaF93qGh7JBJZJviOst6a3gCaRPF+ca4dF6YusJ Uuo9uoa4l0+l44z3JCV12cZIzfG1Rbk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623238777; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i+kXFJUxiAt8nF/gFOeGLQ15QjX96rJgGO1xp0O5Hkw=; b=43aWP7ErEcQ8m4WYdN2jnhMk19VRL9YgzR8Ujy/uFvzbExDd59EeIRYYvZPn/LjgCnkLnc htaDRTjM5wTNlBDA== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id E6952118DD; Wed, 9 Jun 2021 11:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623238777; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i+kXFJUxiAt8nF/gFOeGLQ15QjX96rJgGO1xp0O5Hkw=; b=EZ1sKebsm1bY5kIaC7UF9DQ1G7UTyLUSr9XMyF5zYN+EANnQpxhQm1tfdWkXRzv30znYUQ e2SXselrS/jgk97AcPczw3+LhCZJhHsIaF93qGh7JBJZJviOst6a3gCaRPF+ca4dF6YusJ Uuo9uoa4l0+l44z3JCV12cZIzfG1Rbk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623238777; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i+kXFJUxiAt8nF/gFOeGLQ15QjX96rJgGO1xp0O5Hkw=; b=43aWP7ErEcQ8m4WYdN2jnhMk19VRL9YgzR8Ujy/uFvzbExDd59EeIRYYvZPn/LjgCnkLnc htaDRTjM5wTNlBDA== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id 4CbVN3iowGD6XgAALh3uQQ (envelope-from <vbabka@suse.cz>); Wed, 09 Jun 2021 11:39:36 +0000 From: Vlastimil Babka <vbabka@suse.cz> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Pekka Enberg <penberg@kernel.org>, Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Thomas Gleixner <tglx@linutronix.de>, Mel Gorman <mgorman@techsingularity.net>, Jesper Dangaard Brouer <brouer@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Jann Horn <jannh@google.com>, Vlastimil Babka <vbabka@suse.cz> Subject: [RFC v2 28/34] mm, slab: make flush_slab() possible to call with irqs enabled Date: Wed, 9 Jun 2021 13:38:57 +0200 Message-Id: <20210609113903.1421-29-vbabka@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210609113903.1421-1-vbabka@suse.cz> References: <20210609113903.1421-1-vbabka@suse.cz> MIME-Version: 1.0 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EZ1sKebs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=43aWP7Er; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EZ1sKebs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=43aWP7Er; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C080CC00CBD7 X-Stat-Signature: icwgdky6y3ukp8p5ffa5pthsobyiyajz X-HE-Tag: 1623238773-780982 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
SLUB: reduce irq disabled scope and make it RT compatible
|
expand
|
diff --git a/mm/slub.c b/mm/slub.c index 12d35d6a6eaa..5c70fc17e9be 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2438,16 +2438,28 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) #endif /* CONFIG_SLUB_CPU_PARTIAL */ } -static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) +static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c, + bool lock) { - void *freelist = c->freelist; - struct page *page = c->page; + unsigned long flags; + void *freelist; + struct page *page; + + if (lock) + local_irq_save(flags); + + freelist = c->freelist; + page = c->page; c->page = NULL; c->freelist = NULL; c->tid = next_tid(c->tid); - deactivate_slab(s, page, freelist); + if (lock) + local_irq_restore(flags); + + if (page) + deactivate_slab(s, page, freelist); stat(s, CPUSLAB_FLUSH); } @@ -2457,7 +2469,7 @@ static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu) struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); if (c->page) - flush_slab(s, c); + flush_slab(s, c, false); unfreeze_partials_cpu(s, c); } @@ -2473,7 +2485,7 @@ static void flush_cpu_slab(void *d) struct kmem_cache_cpu *c = this_cpu_ptr(s->cpu_slab); if (c->page) - flush_slab(s, c); + flush_slab(s, c, false); unfreeze_partials(s); }
Currently flush_slab() is always called with disabled IRQs if it's needed, but the following patches will change that, so add a parameter to control IRQ disabling within the function, which only protects the kmem_cache_cpu manipulation and not the call to deactivate_slab() which doesn't need it. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> --- mm/slub.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)