From patchwork Wed Jun 9 11:38:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 12309861 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=-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 489B6C48BCF for ; Wed, 9 Jun 2021 11:40:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F1EEC60FD8 for ; Wed, 9 Jun 2021 11:40:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1EEC60FD8 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 759D26B0088; Wed, 9 Jun 2021 07:39:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 41DF56B008A; Wed, 9 Jun 2021 07:39:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA2186B0092; Wed, 9 Jun 2021 07:39:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id AF9406B0082 for ; Wed, 9 Jun 2021 07:39:36 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 475D9180AD81A for ; Wed, 9 Jun 2021 11:39:36 +0000 (UTC) X-FDA: 78233990352.38.ADC5DF3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf18.hostedemail.com (Postfix) with ESMTP id 7DC79200107A for ; Wed, 9 Jun 2021 11:39:32 +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-out2.suse.de (Postfix) with ESMTPS id E25B21FD6A; Wed, 9 Jun 2021 11:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623238774; 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=volf3/1v2fagmByxx16yvJir7+qLZbMW6i+3I7p6Sqc=; b=lr54bFG1gI4xnJeu9xxylzjCxMUOqNqFn/br4xXHq81J69rcBsj28VivKVSEAEArKZDAqs h4rhgbwAeCs851IARKYZ+p4ZCItRK5L6PHtYZxVglhNAxtFCxN+fYOeSoYthoCHh6aWBOj JWWQgmM/g94TpKtwJNw/LbxsKiSgcVc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623238774; 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=volf3/1v2fagmByxx16yvJir7+qLZbMW6i+3I7p6Sqc=; b=wA99Gg5Pd7WMagaeXluGX6o8cRtQqRLxmU2ZtrWMN2q8RXGYk1MIWLpRajaR3MkBkyPGrN cG2wR3V0vN3R36Cg== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id B391D11A98; Wed, 9 Jun 2021 11:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623238774; 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=volf3/1v2fagmByxx16yvJir7+qLZbMW6i+3I7p6Sqc=; b=lr54bFG1gI4xnJeu9xxylzjCxMUOqNqFn/br4xXHq81J69rcBsj28VivKVSEAEArKZDAqs h4rhgbwAeCs851IARKYZ+p4ZCItRK5L6PHtYZxVglhNAxtFCxN+fYOeSoYthoCHh6aWBOj JWWQgmM/g94TpKtwJNw/LbxsKiSgcVc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623238774; 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=volf3/1v2fagmByxx16yvJir7+qLZbMW6i+3I7p6Sqc=; b=wA99Gg5Pd7WMagaeXluGX6o8cRtQqRLxmU2ZtrWMN2q8RXGYk1MIWLpRajaR3MkBkyPGrN cG2wR3V0vN3R36Cg== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id ONReK3aowGD6XgAALh3uQQ (envelope-from ); Wed, 09 Jun 2021 11:39:34 +0000 From: Vlastimil Babka To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Peter Zijlstra , Jann Horn , Vlastimil Babka Subject: [RFC v2 17/34] mm, slub: check new pages with restored irqs Date: Wed, 9 Jun 2021 13:38:46 +0200 Message-Id: <20210609113903.1421-18-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: imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=lr54bFG1; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=wA99Gg5P; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=lr54bFG1; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=wA99Gg5P; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7DC79200107A X-Stat-Signature: t7f4qas7ezspn13b3zmmaydh4ef6btn5 X-HE-Tag: 1623238772-927597 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: Building on top of the previous patch, re-enable irqs before checking new pages. alloc_debug_processing() is now called with enabled irqs so we need to remove VM_BUG_ON(!irqs_disabled()); in check_slab() - there doesn't seem to be a need for it anyway. Signed-off-by: Vlastimil Babka --- mm/slub.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 378f1cb040b3..760080b58957 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -954,8 +954,6 @@ static int check_slab(struct kmem_cache *s, struct page *page) { int maxobj; - VM_BUG_ON(!irqs_disabled()); - if (!PageSlab(page)) { slab_err(s, page, "Not a valid slab page"); return 0; @@ -2729,10 +2727,10 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, lockdep_assert_irqs_disabled(); freelist = get_partial(s, gfpflags, node, &page); + local_irq_restore(flags); if (freelist) goto check_new_page; - local_irq_restore(flags); put_cpu_ptr(s->cpu_slab); page = new_slab(s, gfpflags, node); c = get_cpu_ptr(s->cpu_slab); @@ -2742,7 +2740,6 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, return NULL; } - local_irq_save(flags); /* * No other reference to the page yet so we can * muck around with it freely without cmpxchg @@ -2757,7 +2754,6 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, if (kmem_cache_debug(s)) { if (!alloc_debug_processing(s, page, freelist, addr)) { /* Slab failed checks. Next slab needed */ - local_irq_restore(flags); goto new_slab; } else { /* @@ -2775,6 +2771,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, */ goto return_single; + local_irq_save(flags); if (unlikely(c->page)) flush_slab(s, c); c->page = page; @@ -2783,6 +2780,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, return_single: + local_irq_save(flags); if (unlikely(c->page)) flush_slab(s, c); c->page = page;