Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6094935pxv; Thu, 29 Jul 2021 06:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1gfX6NnvOKNPuIZ6nQ5hCzMrLQRUqYkeQE2SsI2Wjchx0GEi6pOuXl7WeSoR6tQu2lsEg X-Received: by 2002:a5e:9918:: with SMTP id t24mr4231363ioj.24.1627565118882; Thu, 29 Jul 2021 06:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627565118; cv=none; d=google.com; s=arc-20160816; b=BthH2c7JmRC4Lo7LMj4X2LA/ee049V4YwgAP8bRcfS0ggvuUDrtf8qbXvQ7KADgSvM iancMgzb2B50N26DSYfjWylBYMdph+pYhIqT/Yvn+B1lm1JeCk7B47yZR9JyCTBkvUNv TbGlYwisOy0z+bzM5VK66tmt/8m7S1XzF4ThKpBYV2OeVItFSGjJ3tPtuJLdQJSvmdSW +x94vJ4LrXMTXI8ditIR36/I32zslV8g+GWyxSuDE9hjcA6rPKpfLPPSj1XNMStPiPrG Lnr9aDKIBqxvPxeCT1ztPMsY3R1aRr5bPM5GXThfHEXyaFaaHv293MMLpExcOpY22kvW gJRw== 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=B4vdJolFL2GVYpcikot2LbNLNf+dSU83/o6wpmgcp6o=; b=a/FrpbUDFd1u91uVTDPwNrFgSpLUjt1F2wv11alINl1kBz0YA52KJM83ApIAUej74q uRDdbCLzsSGZdkuGp5Ht7ZdUsWnVeTdTG50wb98jjzlPY7kDiFQ+O/p1v2vqrc8z11pE XjRU95S8i/6ioyP+6bfLVOsabKDnju24ymFHuHnk5VEzDrqPZsJuxzxsF/PNg28vEoP/ EMdveESl/fHNiJDa+VY8rUlPA/ARnXpl0meBdRifP9ODLFkzNpHOWcC0uNXQoub4iyuL 8Y99qE+mpZTn3oy+79Y0qmU2WjlY3zVGtycqOa0GVfBc6tBGif3CNczOHnJjg9PfwjXs MUBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WYagSXYG; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 e16si3593631ils.75.2021.07.29.06.25.07; Thu, 29 Jul 2021 06:25:18 -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=WYagSXYG; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 S237752AbhG2NWi (ORCPT + 99 others); Thu, 29 Jul 2021 09:22:38 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:56788 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237492AbhG2NVr (ORCPT ); Thu, 29 Jul 2021 09:21:47 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 377F120044; Thu, 29 Jul 2021 13:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1627564903; 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=B4vdJolFL2GVYpcikot2LbNLNf+dSU83/o6wpmgcp6o=; b=WYagSXYGnVn3RHhHbl+/Wmv3AyCDrwuVsgobW/8YcpjvqGqpB8dyrBfrO+vv8F6jwo9MiU JW2/Nnry5aVpS55gq2OvKO+1rFCzFymmeOMU2OunWJEndVJo0uwx8uvgxgeODbjZ7RhKQC quMgF7lAjbjWhrPHe1kDdx1cyaASegM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1627564903; 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=B4vdJolFL2GVYpcikot2LbNLNf+dSU83/o6wpmgcp6o=; b=OQKAio0SyrpdzM2mh4lNi0WHqsibNZ2w+xoky0jsVt2lVcHaj3j9uzNRledcO2+7xSqtor EfMiyfQOYKKNSoCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0523713AF4; Thu, 29 Jul 2021 13:21:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sMoRAGerAmF9AwAAMHmgww (envelope-from ); Thu, 29 Jul 2021 13:21:43 +0000 From: Vlastimil Babka To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Mike Galbraith , Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Jann Horn , Vlastimil Babka Subject: [PATCH v3 15/35] mm, slub: restore irqs around calling new_slab() Date: Thu, 29 Jul 2021 15:21:12 +0200 Message-Id: <20210729132132.19691-16-vbabka@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210729132132.19691-1-vbabka@suse.cz> References: <20210729132132.19691-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 by this. 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 187424ebf1d8..43f38fd47062 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1792,9 +1792,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; /* @@ -1853,8 +1850,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; @@ -2782,16 +2777,17 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, 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); 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.32.0