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 59846C433F5 for ; Thu, 14 Apr 2022 03:10:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C925E6B0071; Wed, 13 Apr 2022 23:10:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C40D16B0073; Wed, 13 Apr 2022 23:10:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B079B6B0074; Wed, 13 Apr 2022 23:10:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 9EA9B6B0071 for ; Wed, 13 Apr 2022 23:10:08 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6D3EF272 for ; Thu, 14 Apr 2022 03:10:08 +0000 (UTC) X-FDA: 79354005696.10.F876012 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf27.hostedemail.com (Postfix) with ESMTP id 4C5F44000A for ; Thu, 14 Apr 2022 03:10:07 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id t12so3592789pll.7 for ; Wed, 13 Apr 2022 20:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=x38fxRe2I9332EIqIELmjXuO8tya1CoWYBlRM4dRf9Y=; b=DEQXkwfuO8XG/2J5+9/TexaZwTl30gwLH5K+skHt03SGR7MIro3RVpiei7Z4RSuNp9 1btBtXzkEoUzfIMDttWv7ygA/QNseQt7o9nMmSCv8sZpkeHXxLAqegSkkqSrn11HjwlT uLqet9TK0M2oXxLqk6AjrDc7yMdb9f3JMPqp2N/NBNn0VH6FyXrb979ZDwfcR5qUpgH6 qcSpQx2teJGe/iFCO9UT9un/RtF4dK1YubV+H5bormOuBdvqJIED8uPibsQ+r+ksnVo5 BhxWSyjNsfVlL/57Iyrwn0lOvzl8FsIMLHvZwUfjsd3HPW38cwOYL85diShzl9WXxILJ sZsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x38fxRe2I9332EIqIELmjXuO8tya1CoWYBlRM4dRf9Y=; b=NsnC6Tv/sVkEB3q/AmYSiRwJdiYIbegt4FvtXMLrlquFovipUqNAKnkO2FVqRRw8RS boNnYH2mmu4cp+LTHmr8yXMfsjQkpSBdWZEZjffswJFc07lRy08JUGVise8bPxlZBowI vMkmwUHmkYLgxIC9GhIkSQE5S3DFfvJ8eQ6U4pkkRRc5TW7gyr/gn0Vt4Kha5tgn1Gyq Qd6ngM85fBl/3x+V7M4Y8SMeyBwgEUMrixatkUe4fLE75sWicVeRCGg5aAiNunooz10D X0Y2iw4w62Vj17uO3HkuBiiQKZw+WVQluo39upKKkj3LUsaICaq7vlSp4s+UeEHTxekq nrFg== X-Gm-Message-State: AOAM532sfDjs5inKfuJ3PLnaDra7dCHY2Os7LBWLHEuL+dyyWXmWu4os W7tv0iKD3oDcsywU9PDppoNt0Q== X-Google-Smtp-Source: ABdhPJx26XcNuCBhCeMD0mZWqXVksREg7eMXsF7ScRo4UeehL60oi/zUIX7ce55F4s2S0hYc+pyncw== X-Received: by 2002:a17:903:246:b0:153:84fe:a9b0 with SMTP id j6-20020a170903024600b0015384fea9b0mr45398269plh.163.1649905806015; Wed, 13 Apr 2022 20:10:06 -0700 (PDT) Received: from localhost ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id e6-20020a17090a728600b001cb646a4adfsm4198135pjg.52.2022.04.13.20.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 20:10:05 -0700 (PDT) Date: Thu, 14 Apr 2022 11:10:01 +0800 From: Muchun Song To: Andrew Morton Cc: corbet@lwn.net, mike.kravetz@oracle.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, david@redhat.com, masahiroy@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v8 1/4] mm: hugetlb_vmemmap: introduce CONFIG_HUGETLB_PAGE_HAS_OPTIMIZE_VMEMMAP Message-ID: References: <20220413144748.84106-1-songmuchun@bytedance.com> <20220413144748.84106-2-songmuchun@bytedance.com> <20220413120804.3570dc230a958f4923e3f3c3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220413120804.3570dc230a958f4923e3f3c3@linux-foundation.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4C5F44000A X-Stat-Signature: 84pzzmxezf1jakmpm8ew7cxq7owpzesu X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=DEQXkwfu; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-HE-Tag: 1649905807-868652 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 Wed, Apr 13, 2022 at 12:08:04PM -0700, Andrew Morton wrote: > On Wed, 13 Apr 2022 22:47:45 +0800 Muchun Song wrote: > > > If the size of "struct page" is not the power of two but with the feature > > of minimizing overhead of struct page associated with each HugeTLB is > > enabled, then the vmemmap pages of HugeTLB will be corrupted after > > remapping (panic is about to happen in theory). But this only exists when > > !CONFIG_MEMCG && !CONFIG_SLUB on x86_64. However, it is not a conventional > > configuration nowadays. So it is not a real word issue, just the result > > of a code review. > > The patch does add a whole bunch of tricky junk to address something > which won't happen. How about we simply disable > CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP if (!CONFIG_MEMCG && > !CONFIG_SLUB)? > I'm afraid not. The size of 'struct page' also depends on LAST_CPUPID_NOT_IN_PAGE_FLAGS which could be defined when CONFIG_NODES_SHIFT or CONFIG_KASAN_SW_TAGS or CONFIG_NR_CPUS is configured with a large value. Then the size would be more than 64 bytes. Seems like the approach [1] is more simple and feasible, which also could prevent the users from doing unexpected configurations, however, it is objected by Masahiro. Shall we look back at the approach again? Thanks.