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 1EF04C54EE9 for ; Tue, 13 Sep 2022 07:04:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB13F6B0073; Tue, 13 Sep 2022 03:04:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A60826B0074; Tue, 13 Sep 2022 03:04:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 927F48D0001; Tue, 13 Sep 2022 03:04:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 810486B0073 for ; Tue, 13 Sep 2022 03:04:43 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5662DA092A for ; Tue, 13 Sep 2022 07:04:43 +0000 (UTC) X-FDA: 79906174446.27.4F3A2B5 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf19.hostedemail.com (Postfix) with ESMTP id 531B71A0084 for ; Tue, 13 Sep 2022 07:04:40 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MRZ9h4JQ0zkWpy; Tue, 13 Sep 2022 15:00:40 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 13 Sep 2022 15:04:36 +0800 Subject: Re: [PATCH 12/16] mm/page_alloc: use helper macro SZ_1{K,M} To: Matthew Wilcox , David Hildenbrand CC: , , , References: <20220909092451.24883-1-linmiaohe@huawei.com> <20220909092451.24883-13-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Tue, 13 Sep 2022 15:04:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663052683; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1UNpM4MlVCuzGlKkbs+4X95rnSLruJGM84jVyRlIQjU=; b=Znkl0NRmN/ZzSolV+29mVxQ7LL+UEUg9g05bAUa6iome5wkLJ22OpyhugwZ8BEZJlvYaiM IRYBItrIaXbBPSXARoOOsv17RdflKCnTTnXUTTSfBKOltzGaQtb34+ESsvyGPqmPz/BJcL NfpDpThd1pmBh1aRu3Vkl1MGu0cieEg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663052683; a=rsa-sha256; cv=none; b=gyg3CZqT8/mOjcy2udEY4mcskrNWWK/n7xGeFrRMb45u/Y8R76cMMdx4/G8MYhmYx3wXdg aLB7Ru0jEm2iMzkWyQVLK9lQ5P1Qzg2l80knOBlA8OcTCZHwfXbV2pdTGThoql5yE6h+2Z KKvtLcxXnyeAmY20EAn9y1yY0dNtOK8= X-Rspamd-Queue-Id: 531B71A0084 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam02 X-Stat-Signature: 69wucfppny6kj1yot9kh7gfzkqn8nmcu X-HE-Tag: 1663052680-28501 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 2022/9/10 3:44, Matthew Wilcox wrote: > On Fri, Sep 09, 2022 at 01:34:52PM +0200, David Hildenbrand wrote: >> On 09.09.22 11:24, Miaohe Lin wrote: >>> @@ -9055,7 +9055,7 @@ void *__init alloc_large_system_hash(const char *tablename, >>> /* It isn't necessary when PAGE_SIZE >= 1MB */ >> >> Huh, how could we ever have that. Smells like dead code. >> >>> if (PAGE_SHIFT < 20) >> >> What about adjusting that as well? The it exactly matches the comment >> >> if (PAGE_SIZE >= SZ_1M) Looks good. Will do it in next version. >> >>> - numentries = round_up(numentries, (1<<20)/PAGE_SIZE); >>> + numentries = round_up(numentries, SZ_1M / PAGE_SIZE); > > The git history provides some clues here. See a7e833182a92. > But we do have an architecture which has ... > > #ifdef CONFIG_PAGE_SIZE_1MB > #define PAGE_SHIFT 20 > #define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_1MB > #endif > > I don't think it's an especially common config. Maybe commit a7e833182a92 fixed a theoretical bug. But IMHO, it might be better to keep the code even if no architecture defines PAGE_SIZE >= 1MB. These codes would be eliminated at compiling time. And once there're architectures with PAGE_SIZE >= 1MB, we still work. Any thoughts? Thanks both. Thanks, Miaohe Lin