Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp651478pxt; Thu, 5 Aug 2021 08:26:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr8HoNCcT8oj6MgwYJFXUPhCEB0gOtuYQvlfvQfxanYVYklfquoh5ZMOYHQO1obUwEjI+D X-Received: by 2002:a17:906:b885:: with SMTP id hb5mr5398285ejb.294.1628177186301; Thu, 05 Aug 2021 08:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628177186; cv=none; d=google.com; s=arc-20160816; b=tIoTVqQDlL0nmuWaB4BbvTgWkk/CM7NcP8bxq3d0eZrE3WPYLpqnYxP0aAiELKnwXq hlkj2b0EarqD0FMEN2nZBo6emDNYvCaA8kfQCh2HMjJ1eb2ascUJCf74bArcJLn/b+HJ 3bjBWGTAHD0ePShCLx64c1bjYIdfPLdr15NiMWUdoJTRRtGv2zftVobItK8kWDdJVlX+ Zjrxl4t04nYKsDp5s1s8G3DcUrOcYueU25xjUejBoeONkebj2AmPZsYUwnuDme1uSkl5 1jVgVFzUo1GV0/YkkXok3OwSza+VOfbD6SnG6HFfg5WyfCD0cnw+DJiJxbGipP2HDqfc XRkQ== 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=nOXrWd8xXiPpj97LPVMpLwoNpZ8JIuzAy7sOYm8ZXA0=; b=CfMZRFb7DPjuyZdtLNWGVw6GDP+TBWChxSEdzsMara1Ew6hnOVKiHIBQvxysOKdSdB gi0nM14YAqi3dunE6sKPPfV96YwMsn+OfEmH2GVzGB0ajm5kUAFmdi4+V59k2L2NUEit fHVvQfjUFwXPIcjcgIenl/o3WY/5+XyC4lxcUEEzn1eFUCPuLjk3zAlnJU1DgEA/OBDr aAykOMfqDlHdUeB+zwTUC+CJhbhp8+NOvg+2myVOlY3lmXZkquvbISdeS65Q2lf3GZAX z+sqGAytPjLVcyEF/NPpnr88cXjvIGdyqcGhg+rqlwLOfyrXBGce653LHT/umi97oHxY EehA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=axnmtkgN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=lmA2U4EN; 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 q5si6035636edh.492.2021.08.05.08.26.01; Thu, 05 Aug 2021 08:26:26 -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=axnmtkgN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=lmA2U4EN; 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 S241960AbhHEPYf (ORCPT + 99 others); Thu, 5 Aug 2021 11:24:35 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:34096 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241964AbhHEPUW (ORCPT ); Thu, 5 Aug 2021 11:20:22 -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-out1.suse.de (Postfix) with ESMTPS id F1708223DE; Thu, 5 Aug 2021 15:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1628176806; 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=nOXrWd8xXiPpj97LPVMpLwoNpZ8JIuzAy7sOYm8ZXA0=; b=axnmtkgNecVAlM/uNDsH01WEv/8Lw2a5Oenh/cj2/cDuRWH68+ID7iLEqU/9O5uaamyGkI Cme+TSHb38Rgp9quRs/XVRU1R2zLyFtxUJLCDD4B5B565pb/2lFDzxHb5gD73xFty1Mfpc fcyukvDd6a6dIyawdg7vfJd0tD6Dd7Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1628176806; 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=nOXrWd8xXiPpj97LPVMpLwoNpZ8JIuzAy7sOYm8ZXA0=; b=lmA2U4ENLz6ozFCd/vD3YKwBUjayiZmFKnxrtJuJIDHDBVgylm+Hzcs7i/a1+zujVFqjL1 kEIpbCv3CvohBMCw== 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 C7A0513DAC; Thu, 5 Aug 2021 15:20:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EHP3L6YBDGFDdQAAMHmgww (envelope-from ); Thu, 05 Aug 2021 15:20:06 +0000 From: Vlastimil Babka To: Andrew Morton , Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Galbraith , Sebastian Andrzej Siewior , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Jann Horn , Vlastimil Babka Subject: [PATCH v4 15/35] mm, slub: restore irqs around calling new_slab() Date: Thu, 5 Aug 2021 17:19:40 +0200 Message-Id: <20210805152000.12817-16-vbabka@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210805152000.12817-1-vbabka@suse.cz> References: <20210805152000.12817-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 868a782b6f62..9350ff5110a0 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