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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C6A8C43334 for ; Tue, 5 Jul 2022 08:39:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 142466B0071; Tue, 5 Jul 2022 04:39:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CB9B6B0073; Tue, 5 Jul 2022 04:39:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EACED6B0074; Tue, 5 Jul 2022 04:39:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D573C6B0071 for ; Tue, 5 Jul 2022 04:39:21 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A811533B79 for ; Tue, 5 Jul 2022 08:39:21 +0000 (UTC) X-FDA: 79652396922.29.DD3FFA4 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf29.hostedemail.com (Postfix) with ESMTP id 4B9A3120019 for ; Tue, 5 Jul 2022 08:39:19 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id 76so4998085ybd.0 for ; Tue, 05 Jul 2022 01:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wZnyPsEVZX6HmXQzS1Foy24/qSSliAvcCxVhRkBUcHs=; b=SEYfGEtMxhAMfqAivJTEH2Kz8wbyh2XsCXYeFtFb1I28PpU+lCPk12AA4R9K6dl/bY woHhjBEVabd/bI0pHf8zsBRzuKo9ccK4QyVnqR4OQOMtx1LaA2a9AxK3wkuZNul/LzQV UM51yjWWue6IUw1bK29hDbsh4AwqTyWZZsxAMqbjOcfiIX594dSUkrN1Z+LfE+LXYOW9 WbVktB4yHG4/CR/IBsxUfDoZP5ktqV4FqwcpaZcINT18MM4gCszCXnUDZekNhyzuGtua P2dMbvegXbnzzkLO7dP9z3PzUbofUX0Fv15BJ+c44vzBFlDQt4v4kPDl83LagrfGLi9C xQig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wZnyPsEVZX6HmXQzS1Foy24/qSSliAvcCxVhRkBUcHs=; b=ojLz1IiH6YHB3O9Ifq6DKJ+YDThf+sYr9vTlrvwbtDCyqT/9cc28zHJ4Z85wIK7GAm at1u6QwEWVLGPHt+TKB3RDvOLqxd5/I+aEMiS0jKsSYPGWFAPoL5hPTl7A4KiUAwmNJn BDJx4VPjer9awMhr9BYHoYcHaGpfPC0ujY1yV3wRypEjGA5bSlpfjT0UTifw/YNHmb76 JEgmz78o6PbQzd8DCwLV3BmUq3Gy2dI7bBVpf4YwbyuMe06gsY75cml9KQsZyRcuLPN7 De94bkVGy4xQ/C2y/19fqOlZfUqrJITUn+epSa9WInF+OtggeRB3bcQVTxuGu49KJxg6 bI/w== X-Gm-Message-State: AJIora/4+bTiIlRdjN5e9qcr9xOpYxb9OabXY+p9cHVdSr0DsZIq9k6e nlUT5uYzICJfrDpGVvw3u/tgiwu9NxIrqj3eHRE+zQ== X-Google-Smtp-Source: AGRyM1sb7EaZDlA3TlP6vCkKVLuCtGyEFUyGiDkCzrHwcXTE7yLWJhhYPQxkfnh364COElsTV8UMrZRX8TXd5VzakYY= X-Received: by 2002:a25:8388:0:b0:66e:3afd:9299 with SMTP id t8-20020a258388000000b0066e3afd9299mr12223142ybk.246.1657010358371; Tue, 05 Jul 2022 01:39:18 -0700 (PDT) MIME-Version: 1.0 References: <20220704112526.2492342-1-chenhuacai@loongson.cn> <20220704112526.2492342-5-chenhuacai@loongson.cn> In-Reply-To: From: Muchun Song Date: Tue, 5 Jul 2022 16:38:41 +0800 Message-ID: Subject: Re: [PATCH V4 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP To: Arnd Bergmann Cc: Huacai Chen , Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , loongarch@lists.linux.dev, linux-arch , Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , Andrew Morton , Linux-MM , "open list:BROADCOM NVRAM DRIVER" , Linux Kernel Mailing List , Linux ARM , Feiyang Chen Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657010361; a=rsa-sha256; cv=none; b=PGiJM/a5qV4o50MaTUcXpyftHYklhFEtC6F2aYpvq/VubdKYPsh8/GJD/RO4Q9mMEsn9kF aHvyILNPx638sp8hXsmlt7z8PjGnbGsJ8lVTmFvZ4JWSsvvOjibr+2la/NjZokfssTFMIy AGzcperqFzi2SiYAG5LAlXhKWcG8jBI= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SEYfGEtM; spf=pass (imf29.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657010361; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wZnyPsEVZX6HmXQzS1Foy24/qSSliAvcCxVhRkBUcHs=; b=IYMevO61X7v5GP8sCWpc05eMVAHC3delOfbwBCKZNUFAxLVlb9BDApFuMiysq/fzvx9mMM aS/I7p7LpRWMYXXDhm/ELb6gKFqtrg05xP0GTAJ7IGZo3T4dxApC8D8dWtJpBkjJfPgyol KBqFFw6Wrexq0Af6XIU93KyqXINdBDw= X-Stat-Signature: wt3htawbk6wsf4cudbn4nhu4aenrbxcz X-Rspamd-Queue-Id: 4B9A3120019 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SEYfGEtM; spf=pass (imf29.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1657010359-588442 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 Tue, Jul 5, 2022 at 4:06 PM Arnd Bergmann wrote: > > On Tue, Jul 5, 2022 at 9:51 AM Muchun Song wrote: > > > > On Tue, Jul 5, 2022 at 2:22 PM Huacai Chen wrote: > > > > > > Hi, Arnd, > > > > > > On Mon, Jul 4, 2022 at 8:18 PM Arnd Bergmann wrote: > > > > > > > > On Mon, Jul 4, 2022 at 1:25 PM Huacai Chen wrote: > > > > > To avoid the following build error on LoongArch we should include linux/ > > > > > static_key.h in page-flags.h. > > > > > > > > > > In file included from ./include/linux/mmzone.h:22, > > > > > from ./include/linux/gfp.h:6, > > > > > from ./include/linux/mm.h:7, > > > > > from arch/loongarch/kernel/asm-offsets.c:9: > > > > > ./include/linux/page-flags.h:208:1: warning: data definition has no > > > > > type or storage class > > > > > 208 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON, > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > > ./include/linux/page-flags.h:208:1: error: type defaults to 'int' in > > > > > declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-int] > > > > > ./include/linux/page-flags.h:209:26: warning: parameter names (without > > > > > types) in function declaration > > > > > > > > I wonder if page_fixed_fake_head() should be moved out of line to avoid > > > > this, it's already nontrivial here, and that would avoid the static key > > > > in a central header. > > > I have some consideration here. I think both inline function and > > > static key are instruments to make things faster, in other words, > > > page_fixed_fake_head() is a performance critical function. If so, it > > > is not suitable to move it out of line. > > > > +1 > > > > The static key is an optimization when HVO is disabled. > > How about splitting up linux/page_flags.h so the static_key header is > only included > in those places that use one of the inline functions that depend on it? > How about including the static key header in the scope of CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP? diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 465ff35a8c00..4dd005ad43fc 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -205,6 +205,8 @@ enum pageflags { #ifndef __GENERATING_BOUNDS_H #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP +#include + DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key); /*