From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76753C4741F for ; Mon, 9 Nov 2020 11:33:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D748C206ED for ; Mon, 9 Nov 2020 11:33:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D748C206ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1504A6B0036; Mon, 9 Nov 2020 06:33:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 101B26B005D; Mon, 9 Nov 2020 06:33:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE2336B0068; Mon, 9 Nov 2020 06:33:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id C1AC36B0036 for ; Mon, 9 Nov 2020 06:33:53 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5EB2A1EE6 for ; Mon, 9 Nov 2020 11:33:53 +0000 (UTC) X-FDA: 77464670346.03.turn40_59066bc272ec Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 37A5828A4E8 for ; Mon, 9 Nov 2020 11:33:53 +0000 (UTC) X-HE-Tag: turn40_59066bc272ec X-Filterd-Recvd-Size: 4171 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Nov 2020 11:33:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2BA62ABF4; Mon, 9 Nov 2020 11:33:51 +0000 (UTC) Subject: Re: [PATCH v5 1/5] mm: introduce debug_pagealloc_{map,unmap}_pages() helpers To: Mike Rapoport , Andrew Morton Cc: Albert Ou , Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christian Borntraeger , Christoph Lameter , "David S. Miller" , Dave Hansen , David Hildenbrand , David Rientjes , "Edgecombe, Rick P" , "H. Peter Anvin" , Heiko Carstens , Ingo Molnar , Joonsoo Kim , "Kirill A . Shutemov" , "Kirill A. Shutemov" , Len Brown , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Pavel Machek , Pekka Enberg , Peter Zijlstra , "Rafael J. Wysocki" , Thomas Gleixner , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, x86@kernel.org References: <20201108065758.1815-1-rppt@kernel.org> <20201108065758.1815-2-rppt@kernel.org> From: Vlastimil Babka Message-ID: <4bd5ae2b-4fc6-73dc-b83b-e71826990946@suse.cz> Date: Mon, 9 Nov 2020 12:33:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201108065758.1815-2-rppt@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/8/20 7:57 AM, Mike Rapoport wrote: > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -1428,21 +1428,19 @@ static bool is_debug_pagealloc_cache(struct kmem_cache *cachep) > return false; > } > > -#ifdef CONFIG_DEBUG_PAGEALLOC > static void slab_kernel_map(struct kmem_cache *cachep, void *objp, int map) > { > if (!is_debug_pagealloc_cache(cachep)) > return; Hmm, I didn't notice earlier, sorry. The is_debug_pagealloc_cache() above includes a debug_pagealloc_enabled_static() check, so it should be fine to use __kernel_map_pages() directly below. Otherwise we generate two static key checks for the same key needlessly. > > - kernel_map_pages(virt_to_page(objp), cachep->size / PAGE_SIZE, map); > + if (map) > + debug_pagealloc_map_pages(virt_to_page(objp), > + cachep->size / PAGE_SIZE); > + else > + debug_pagealloc_unmap_pages(virt_to_page(objp), > + cachep->size / PAGE_SIZE); > } > > -#else > -static inline void slab_kernel_map(struct kmem_cache *cachep, void *objp, > - int map) {} > - > -#endif > - > static void poison_obj(struct kmem_cache *cachep, void *addr, unsigned char val) > { > int size = cachep->object_size; > @@ -2062,7 +2060,7 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags) > > #if DEBUG > /* > - * If we're going to use the generic kernel_map_pages() > + * If we're going to use the generic debug_pagealloc_map_pages() > * poisoning, then it's going to smash the contents of > * the redzone and userword anyhow, so switch them off. > */ >