Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp413265pxm; Wed, 2 Mar 2022 18:46:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO/fPmu4+RSfuBsZDg1ALckhieAHcuNl6Qjd82aZtWHjMDPvwbba6jVs1FtybhgHriDtoy X-Received: by 2002:a17:902:e552:b0:14f:bfec:eb2c with SMTP id n18-20020a170902e55200b0014fbfeceb2cmr33916780plf.108.1646275604986; Wed, 02 Mar 2022 18:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646275604; cv=none; d=google.com; s=arc-20160816; b=CedUYqz+WicrAL3wmrPF8sXRvVRoCfFutwCjZr8lFX4pCDpgYkkaB9fx+65x/MS9tj 51evi7RtFhicjqvesXU+dHx1OeY5vSAJGXDRzW0XYkoo7KlGQScchNs5ZCmu69aXOJNa ELVxGqRS36jF1RFbfQlUmhtZg7hDN7yaO08tp7iW/rGa5KUb7gVR50h4pgPVxOI2Z7ZW gY2Q8vI00cubDMbSbR7zNz4GylSKipvTlZciRcTKF7riUuONqWM2NG0doAfni18M5qM2 myIMKL2XM9Zo9mshvVYWvJFdE5C8B7cyIONXD2woUU3tZBTpVA4sx34VjO2b1P2SHYgL ityA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XVZxRuOCFhfG5UcNmUMrWY5dCexmZUcmM57vzOUtIzc=; b=UZ3m/nPz586pBnAMNL87HQKwxvDAvgNMNHxeMQZBEISo3yaz5wIwyYn7Iy00Te26U8 Pm8CRLU6+cOdWJ9BSsCIJOSyD1/C5heTsWW3Y98vlisqmpLVi6NR34rk60bs6NxIR2Wb KqM/hzXaCuf2yR9OT6VX1q5MyUpoKiW7laFKgP2T+W/wNgY2+Xv2oGrH1CAvK6NrzBWo SZ5o2nKr+MowZaoFbZbJxZhrQpXJebx+1PbEwPv1jyOclLC3FrMTIpYsOTf7boXYfqO/ 8XcpQAqlwW/+Fag2/4ceOEMZEOKWHO6JL2lkJK3KRv31mfi0WnUYeSzPGV7hjn3yUdss Wp0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=GVGoVZQO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w9-20020a170902904900b0014d5c4a5ae6si795306plz.255.2022.03.02.18.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 18:46:44 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=GVGoVZQO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84C2BDF44; Wed, 2 Mar 2022 18:39:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbiCCCjq (ORCPT + 99 others); Wed, 2 Mar 2022 21:39:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbiCCCjp (ORCPT ); Wed, 2 Mar 2022 21:39:45 -0500 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23156574 for ; Wed, 2 Mar 2022 18:39:00 -0800 (PST) Received: by mail-yb1-xb2e.google.com with SMTP id g26so7344835ybj.10 for ; Wed, 02 Mar 2022 18:39:00 -0800 (PST) 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=XVZxRuOCFhfG5UcNmUMrWY5dCexmZUcmM57vzOUtIzc=; b=GVGoVZQOnRHwG3P1PJBo4RsNL8GTz8cSKlk7KeWh3ORutP3ONhWSiWCJv/naf7dd1p Aj2ieYCAxIGIriKvQ7QxjqwIeznojcIS6o8j0DA0n/vGhnMUDtgtUyWL9aZhyuBUMyOL iRqrBthwmJvILGWjOj5oxXyz5L9rxeW1Br5WF7pFIr1MYvl2XfiLW9LY/MqQoDi57te6 tmrtvYxRKD4DKzveOAX62nDZFsWngJajNYhwlvwJ4wqKF0WwkpPJrYM75nqyrFbWf030 yygB8L5NdBLlxDXn6BjUHB51vASX1hIK91GUP/64hrJwqTP2VbEsKMCu5JHyYRxoacls dS+w== 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=XVZxRuOCFhfG5UcNmUMrWY5dCexmZUcmM57vzOUtIzc=; b=U+XeDkgZcbZSS92UNpJIh39CAKNBqXbxNqg1oJv4/PQ6/I27lglz4Lx87pRwnP4m4a vo8hKjbRoQi7P4gX4MUpj4JO+MfJotN9xCKc3nUVrrRJ6cKFij5rmguIN5T7K891dExI MCPdaxgxuEnTSy3fiVvjof5XV98HBge4CBVRzEY70C6fuOv5KuKBsDSbI2vuKq39krZn wMikVTqqkIjnyVo70PFmXeXKs7ElCntbQy9anPmoudSMtTdRKbFBlD//YH3h37KEBYqn mYfWWNmCZmt9hBqZyTlUxMTTwQm773ZBC8cGZNL/ZAmQARVWc0c4TT5r9zQXdVa7q0Me Wa+Q== X-Gm-Message-State: AOAM533PCswk8DfcolutqHHYjWakMuqL3x57gQCwTmQH1CPsepct9/mt +rzHZWjt7w1Q85YVLsh8Ch2XVVvdf1fvgG95gyTqVg== X-Received: by 2002:a25:6b4a:0:b0:628:a387:6123 with SMTP id o10-20020a256b4a000000b00628a3876123mr5114625ybm.132.1646275140013; Wed, 02 Mar 2022 18:39:00 -0800 (PST) MIME-Version: 1.0 References: <20220302083758.32528-2-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Thu, 3 Mar 2022 10:38:23 +0800 Message-ID: Subject: Re: [PATCH v2 1/3] mm: hugetlb: disable freeing vmemmap pages when struct page crosses page boundaries To: Luis Chamberlain Cc: Jonathan Corbet , Mike Kravetz , Andrew Morton , Kees Cook , Iurii Zaikin , Linux Doc Mailing List , LKML , Linux Memory Management List , Xiongchun duan , Muchun Song , Adam Manzanares , Davidlohr Bueso Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 3, 2022 at 5:21 AM Luis Chamberlain wrote: > > On Wed, Mar 02, 2022 at 04:37:56PM +0800, Muchun Song wrote: > > If CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON is enabled and the size > > of "struct page" is not power of two, we cannot optimize vmemmap pages > > of HugeTLB pages. We should disable this feature in this case. > > The commit log does not describe what happens if this is left enabled in > that case? Is this a fix? Why would it be a fix? Was something failing? > How did you spot this issue? What are the consequences of not applying > this patch? > If the size of "struct page" is not the power of two and this feature 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_SLAB 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. But we cannot prevent someone from configuring that combined configure. OK, this information should go to the commit log. Will update it. Thanks.