Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1495154pxv; Fri, 2 Jul 2021 05:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8rsPj6qIU6iA8zQhkMU/mP60XtrYhB7UAyXUu8AkysFOSr1qM1RCtb+R+C5b3eEXl57SY X-Received: by 2002:a05:6402:510d:: with SMTP id m13mr6241243edd.179.1625228413437; Fri, 02 Jul 2021 05:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625228413; cv=none; d=google.com; s=arc-20160816; b=DiqV6deNLbcR2XaC4+gH4gbOJYJr7OcEgnNymntVlz77Gnpi25+KpEQOH0K0nquuom wKPkqpFaCIalIcn+eGw9/hyFh4STFmCKpcqsRmuCdf28nyiCdEMUbo3LSJI07BnJjOuM Tzeg3ERygj5f74GhQyE2nBUxNyTeJdKZSQYXtYiWKw65xn9DAIqMFj6Fu3dzvfzB7AQC Vi0x9eo1VkM4eIUiMJfuHYeIwCRp7sQAWxH1eYg6DhahzzS6xCejSCagPfCKkDo9Me3i YxvkTvgLczblhtH7DoxqOw6jwz0rqNTE5F/8H5Ic/ZTKu+cuXi+CKnOPweeWALa89lW0 YTsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=GayRj68MxYlhLq1b72BYBOzpVTzkn6ZlV4tZ2wvOh7w=; b=d+MBZ//LsDLc/VRVwXVuEKBmVhiN3hdhkROtmWb2ubBtkKfi5+/x8BB879t5MMc1+2 1/97kWZj8YtwqdkFcM3zRKVx2b1Wm2D2oqiHB+YHGClY9kpn00CrUe8KXyT07+mkyY6v de3wR/AHYrYXsGj4CkjpkYNoNFdw+iEy67iaPZhMV4D0cHfD5buUHa55DWIzZy6aBWT8 KKZXLXz3qJUBpITQA/X6mgeyi959updlVAz7HnqNt6JeR12aO8dUqsspDUCUha/Y10Rp ve5/LOCY0yVNiq5wTdl6mcATQ0GsjSohn5ZG0e22xkGcPc35bnGiexRSFTrY1sCSuAT2 qtzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Cw4KZ3Db; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rflAF7uI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eo9si3518085ejc.528.2021.07.02.05.19.49; Fri, 02 Jul 2021 05:20:13 -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=@linutronix.de header.s=2020 header.b=Cw4KZ3Db; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rflAF7uI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232107AbhGBMUd (ORCPT + 99 others); Fri, 2 Jul 2021 08:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbhGBMUZ (ORCPT ); Fri, 2 Jul 2021 08:20:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F6DC061764 for ; Fri, 2 Jul 2021 05:17:53 -0700 (PDT) Date: Fri, 2 Jul 2021 14:17:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1625228271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GayRj68MxYlhLq1b72BYBOzpVTzkn6ZlV4tZ2wvOh7w=; b=Cw4KZ3DbM3XM9/ouqvqzAGiIhwYUuKq7vRGFxLVCC4rkOq5FsdkbVQvcNrJAiDRNmvzSsx C3EkL8+242kyNQcjdbKkYjjHcV02KYDavb2LIImrvfGznL28qXzkU0T3uiF+xJV3YF33NH pDrc2MY4w4olSuPBi1YS49DRnGDz8yE7Pha1+WzUzmaWoiR/aRKxSIndWzZ/X9EodY+97V qH3NvNga5USmwE2UNVeGAS3gco6AE5Nv2pJn4WvTZI50C0UnT/rg509YBRnnjnentFnJZG dj4r9ywKiH+UyrA+4r9xQmnprnTXUs+R4Hio/flljWXOo28e2102HqUcYLCEqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1625228271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GayRj68MxYlhLq1b72BYBOzpVTzkn6ZlV4tZ2wvOh7w=; b=rflAF7uIIPZLISkwTB0wCO+VkyX7Cp4wKoawbaMXO9umI0hjececP3AtZm42aWNpDQHE/5 v+7iaxDNOgGn8yCg== From: Sebastian Andrzej Siewior To: Vlastimil Babka Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim , Thomas Gleixner , Mel Gorman , Jesper Dangaard Brouer , Peter Zijlstra , Jann Horn Subject: Re: [RFC v2 31/34] mm, slub: optionally save/restore irqs in slab_[un]lock()/ Message-ID: <20210702121749.edrkrwf6uaxwoiyp@linutronix.de> References: <20210609113903.1421-1-vbabka@suse.cz> <20210609113903.1421-32-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210609113903.1421-32-vbabka@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-06-09 13:39:00 [+0200], Vlastimil Babka wrote: > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -353,18 +353,35 @@ static inline unsigned int oo_objects(struct kmem_cache_order_objects x) > /* > * Per slab locking using the pagelock > */ > -static __always_inline void slab_lock(struct page *page) > +static __always_inline void > +__slab_lock(struct page *page, unsigned long *flags, bool disable_irqs) > { > VM_BUG_ON_PAGE(PageTail(page), page); > + if (disable_irqs) > + local_irq_save(*flags); > bit_spin_lock(PG_locked, &page->flags); > } > > -static __always_inline void slab_unlock(struct page *page) > +static __always_inline void > +__slab_unlock(struct page *page, unsigned long *flags, bool disable_irqs) > { > VM_BUG_ON_PAGE(PageTail(page), page); > + if (disable_irqs) > + local_irq_restore(*flags); > __bit_spin_unlock(PG_locked, &page->flags); > } You should first unlock then enable IRQs. Sebastian