Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3846988pxj; Mon, 24 May 2021 16:44:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5fsVvzMrmamKjyizGoBzBBP4RkvJ7hQaNmUIxl6gY1cmOgkCk6fjKSZKrwA62SXzURPym X-Received: by 2002:aa7:c5c6:: with SMTP id h6mr10157071eds.127.1621899886368; Mon, 24 May 2021 16:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621899886; cv=none; d=google.com; s=arc-20160816; b=xbT4MlkFyg+seUJNKKVjPaNuzj94UvZEmA74VQpXNyVugjd34cd12+08Kmrh+Rk1o8 etTJCgMGaWVZ7xS5bsZD8BIaYSaTV2Uf4b4UQRWrzzxItgM8vQYaaLcSBvWD99+lKGp7 mnwbstdsUBHf/vGgVi3Bu2DXKjnk9y8R9nZUl5Tx69bR2BTCnsPF+RKNOvXWQpeZ1U/T P4ixHQCIjKP0Bv1RE3Cv0kpS8azwar8R6E8FDg2QstrPI+nDd0z7qy9D/az8QtVeSUAA fEkm7elrsa16JRgv0JZ9B6IZiUXTxaD9litrvmQ2QuK4QZdoUgFYzUYQ111oWFYcdhab 5I0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=sQLMuAwFVacxN4qcB9BYnkAY7iSwJSx4+lprGLP70p4=; b=uclWQZZ480LBhie8wzOEJsp32+sE7d9jiGrbMFki8NA92wHfCVD8WXemwYFpVUjjJl QPVgDZ+YmgBJ8gRMkH+8KQ874pUsgvGPlbwvtLiagnR5p43FNqYwVsATkPpvmYN2h7L2 rDG8exXbZQEIcH8gwj18TESlsvgjXrTZ1iYslDpi+mk7mSltAECp1QZaJ5ZfqQiz5hrn h5c7BDSo47FVdUwos9jy2AkecTq2yaQBThMgprejKzmD1E41hjLl1Z0h4U5DLc7f/aVU 9XZDblffKWF3os47teatB0ts46mLYcxowemrg6s7EFf6SUsZ0Tr99hkWBQG9hJOwDJhx jRdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=JI6bEEzd; dkim=neutral (no key) header.i=@suse.cz; 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 sb9si16679558ejb.15.2021.05.24.16.44.23; Mon, 24 May 2021 16:44:46 -0700 (PDT) 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=@suse.cz header.s=susede2_rsa header.b=JI6bEEzd; dkim=neutral (no key) header.i=@suse.cz; 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 S230150AbhEXXnE (ORCPT + 99 others); Mon, 24 May 2021 19:43:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:50770 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhEXXmU (ORCPT ); Mon, 24 May 2021 19:42:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1621899648; 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=sQLMuAwFVacxN4qcB9BYnkAY7iSwJSx4+lprGLP70p4=; b=JI6bEEzd3fZbSUoGqJeVio2RMWzHr2DAOzk0pZPLW7gawqj2ziSUXjtyZ9gm0dROEq9j0z vTMaI6YTlh3Crww9nbIHVlYF/eNTCRugh2V6ogLkeSm3FfEXxpd4Jioljll/CjPY/6oY12 gbaVnRi3aqpgwHA9xv6GG28bJuBGszs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1621899648; 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=sQLMuAwFVacxN4qcB9BYnkAY7iSwJSx4+lprGLP70p4=; b=zYny06N4budx7QoJzV0fGTD8jC89R5j4o/K4P0vrMToS5Fy8rZdu1jJdxJNjOHO/O/6SwA psuFazzZW0zNH4CQ== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 54973AF32; Mon, 24 May 2021 23:40:48 +0000 (UTC) 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 12/26] mm, slub: restore irqs around calling new_slab() Date: Tue, 25 May 2021 01:39:32 +0200 Message-Id: <20210524233946.20352-13-vbabka@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524233946.20352-1-vbabka@suse.cz> References: <20210524233946.20352-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org allocate_slab() currently re-enables irqs before calling to the page allocator. It depends on gfpflags_allow_blocking() to determine if it's safe to do so. Now we can instead simply restore irq before calling it through new_slab(). The other caller early_kmem_cache_node_alloc() is unaffected Signed-off-by: Vlastimil Babka --- mm/slub.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 16f3cbb81627..47a3438d6a35 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1763,9 +1763,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) flags &= gfp_allowed_mask; - if (gfpflags_allow_blocking(flags)) - local_irq_enable(); - flags |= s->allocflags; /* @@ -1824,8 +1821,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) page->frozen = 1; out: - if (gfpflags_allow_blocking(flags)) - local_irq_disable(); if (!page) return NULL; @@ -2753,17 +2748,18 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, goto check_new_page; } + local_irq_restore(flags); migrate_enable(); page = new_slab(s, gfpflags, node); migrate_disable(); c = this_cpu_ptr(s->cpu_slab); if (unlikely(!page)) { - local_irq_restore(flags); slab_out_of_memory(s, gfpflags, node); return NULL; } + local_irq_save(flags); if (c->page) flush_slab(s, c); -- 2.31.1