Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp9905401ybc; Sat, 30 Nov 2019 17:19:39 -0800 (PST) X-Google-Smtp-Source: APXvYqxO/wraXDrQotfuZOCyn0XLGP0I5hGQTkPbLGHP76hphFLEg5lnocXiStfcSP+90RCxvQce X-Received: by 2002:a05:6402:1d2d:: with SMTP id dh13mr1353930edb.128.1575163179460; Sat, 30 Nov 2019 17:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575163179; cv=none; d=google.com; s=arc-20160816; b=ol90FREX6I1MAcWKNy+0um5XMfwqsEmV4ucVAOJZxDEGq/zFJj6ZnTf7sfkTmXuSxM ZiCtDeqpNGrurI/zgsiarfo/xxlBacy8voHqn0H/WHqITYmf1L+Uj+jTJHTZh4PJSSxR 75UUYmmVJ/hiA0PyXHISeU/qUPeEiyriEHSD7fptpN6XHl5GX/EACCyk1r92k3LGi9gA +dFwuaUaYiheKr8zJ/Ip4O1cIcrJ3CzGMW0Eqh2DFWJhzbng8GdAdrcVho6v4cfwKab3 VpCOLSPhA/q7oOWj8fM3eNUO0hliZtdGCTPMaODv1BzhOxrCoxoMX9c/nFlScaUAZTiF 1Pcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7t1o0CePuaGi72IYYDmIzVQ771lheBw+8PbxBjs4mEE=; b=hYHqPxqorbryOfw3lwUaEw6kmr0p2NY8+pJ/BWaiVlYTeIelDsIHVQ6S1PmrUABuFS Xru8HyXg/t7mb5mFg2UT/jcxLtoER8UaWLiweIls6uc2DFa5jdSB/b+Pf+64dcjBTfJo 4n54GAPNFrpOPermcMeWo8W/iY7QmcxqgPJzY7u70iLzgVAJOVfHYa4/8ot+55P+oo3Y LRLho7jZ363rR1JpgnT5AyPN6uMbLISIwI5lZSMX/9s0sTxt9/bnNCI61bxJiCQE6zFU o5IUP+1hhPgtaWYVPD0RftcckbF2poD7RiSCtx8k4MWsFFXDGJgFTGrFNjSGNwuRL1fm pPpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si4100574edr.399.2019.11.30.17.19.16; Sat, 30 Nov 2019 17:19:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbfLABRv (ORCPT + 99 others); Sat, 30 Nov 2019 20:17:51 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:55022 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbfLABRv (ORCPT ); Sat, 30 Nov 2019 20:17:51 -0500 Received: from fsav302.sakura.ne.jp (fsav302.sakura.ne.jp [153.120.85.133]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id xB11HnPK006289; Sun, 1 Dec 2019 10:17:49 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav302.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav302.sakura.ne.jp); Sun, 01 Dec 2019 10:17:49 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav302.sakura.ne.jp) Received: from [192.168.1.9] (softbank126040062084.bbtec.net [126.40.62.84]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id xB11Hh7Y006132 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NO); Sun, 1 Dec 2019 10:17:48 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [FIX] slub: Remove kmalloc under list_lock from list_slab_objects() V2 To: Andrew Morton , Christopher Lameter Cc: Yu Zhao , Pekka Enberg , David Rientjes , Joonsoo Kim , "Kirill A . Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" References: <20190914000743.182739-1-yuzhao@google.com> <20191108193958.205102-1-yuzhao@google.com> <20191108193958.205102-2-yuzhao@google.com> <20191109230147.GA75074@google.com> <20191110184721.GA171640@google.com> <20191130150908.06b2646edfa7bdc12a943c25@linux-foundation.org> From: Tetsuo Handa Message-ID: <54b6c6a1-f9e4-5002-c828-3084c5203489@i-love.sakura.ne.jp> Date: Sun, 1 Dec 2019 10:17:38 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191130150908.06b2646edfa7bdc12a943c25@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/01 8:09, Andrew Morton wrote: >> Perform the allocation in free_partial() before the list_lock is taken. > > No response here? It looks a lot simpler than the originally proposed > patch? > >> --- linux.orig/mm/slub.c 2019-10-15 13:54:57.032655296 +0000 >> +++ linux/mm/slub.c 2019-11-11 15:52:11.616397853 +0000 >> @@ -3690,14 +3690,15 @@ error: >> } >> >> static void list_slab_objects(struct kmem_cache *s, struct page *page, >> - const char *text) >> + const char *text, unsigned long *map) >> { >> #ifdef CONFIG_SLUB_DEBUG >> void *addr = page_address(page); >> void *p; >> - unsigned long *map = bitmap_zalloc(page->objects, GFP_ATOMIC); Changing from !(__GFP_IO | __GFP_FS) allocation to >> + >> if (!map) >> return; >> + >> slab_err(s, page, text, s->name); >> slab_lock(page); >> >> @@ -3723,6 +3723,11 @@ static void free_partial(struct kmem_cac >> { >> LIST_HEAD(discard); >> struct page *page, *h; >> + unsigned long *map = NULL; >> + >> +#ifdef CONFIG_SLUB_DEBUG >> + map = bitmap_alloc(oo_objects(s->max), GFP_KERNEL); __GFP_IO | __GFP_FS allocation. How is this path guaranteed to be safe to perform __GFP_IO | __GFP_FS reclaim? >> +#endif >> >> BUG_ON(irqs_disabled()); >> spin_lock_irq(&n->list_lock);