Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp193401rwb; Tue, 13 Dec 2022 16:08:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4gMFo0UoN4Ynsgok8zqHxLLY2N8hUM/vJsI9xVDrRdYfOMll7zuaoWZLP6uKVFdNWSGn3u X-Received: by 2002:a05:6a20:9f4f:b0:a4:aa40:2253 with SMTP id ml15-20020a056a209f4f00b000a4aa402253mr26439436pzb.21.1670976494381; Tue, 13 Dec 2022 16:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670976494; cv=none; d=google.com; s=arc-20160816; b=chUEDL8tVMt6zmr7C+tnoPUnhwMepfhQw0EUoBppKK8jVpTLzXxCuP/SvRseCeEaiM dGtHc8OGD60Vf3/TQi73Y4QfRKDGCfpx5tqC2uYawavndE0/bKvcqDBQpKGJESF42Z+l uGXvE5MD9ZJolBLpmPCz/MH5I7LcaeQw8sif1/xAzK9oIwRH8Lbmi78z5vUPhbUkT2JL 2HDLjNr2ptGMBCD4voPBRztTei+Bx8Jkf0Qwf9anQea2qMRIFwQbUL6I3OzG7U5XsnZD rmudqDGr0IKu0qXiAHZjcZ3xeJbx56goxp7PpmszzjVLvmzY1l+2yDxTa8dBrSm2PhI3 fBQA== 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=8kNUFsiSapaEOV7ygdQ/RnZuA4WU7ECuH6Dq3VkyTdI=; b=Z6sfEpnPxhJL8aCLnmYZ9M/VD6UHXGevaEbuvQQJDNl5JBTMMLpcHZbbXluV1auV0x lVQyrpmKSjRZ6NK0ObdSY7Sto2Md3FlreFHUjzF3KjJvVAn3tUavuVbCb2GjeXJMo/CA 7FxxdMDo3+tx8pR48kInTHQxiiGmQ2HJ//hTdeAMPQkXdpXMAH7uv/PZFvdtushVpA84 qWAaMChHEH2w+yhAATnv/mmIrlsptO3OplyCRpJoghFUg1+kNKnLhrhPmVsEijEjsLWl CwrDOjhMnxfLMRNPKS5k1YkOoN53QxHxVEm+k8VKdEIiTqPZXP3ycyTSw8kR8arwyYVB A15A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LYcTaHOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a170902ce8500b00188a7401d89si1201250plg.481.2022.12.13.16.07.58; Tue, 13 Dec 2022 16:08:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LYcTaHOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236983AbiLMXys (ORCPT + 72 others); Tue, 13 Dec 2022 18:54:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236598AbiLMXyq (ORCPT ); Tue, 13 Dec 2022 18:54:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74161114E for ; Tue, 13 Dec 2022 15:53:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670975638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8kNUFsiSapaEOV7ygdQ/RnZuA4WU7ECuH6Dq3VkyTdI=; b=LYcTaHOrEMtbLz1A7e8dVz8cdLsH/rQEErj9d1btmPu4PAxDfdWNO/doxARZJu9OaqG4jp sepbKKcI77NXsrxmvVxh/pK2OvhsrmLxjjjR1jRWLgL0aEWw0khuNjnz4K7wgtAr4tAEGg nQ+yjrNdKMUua8B3dMR/lCcAR/6aTG8= Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-317-kJiZCHGyPDmVgIK-CabHSQ-1; Tue, 13 Dec 2022 18:53:57 -0500 X-MC-Unique: kJiZCHGyPDmVgIK-CabHSQ-1 Received: by mail-yb1-f199.google.com with SMTP id i19-20020a253b13000000b0070358cca7f7so18370709yba.9 for ; Tue, 13 Dec 2022 15:53:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8kNUFsiSapaEOV7ygdQ/RnZuA4WU7ECuH6Dq3VkyTdI=; b=mUr7tv0LG9iX8bcDUNdXn1HckoodVqDgVh9BaLNLfjvChtbAqmbvCJ2cIsxdHK9caV P+Lh7vGGlxv5DIHB6EQfua4RFseUDo9BtDBvkVE64SWG6CVjlGxEhNdCgQjHEkKFZrmQ /RUBG9Ih2IAZZEFnHsoyBI+doQGc4eqpQaaZuX1of8zFV+ak+lS69M+lGYmUagK1ctfR YL4KAReQtndJ4LaWfMQu36+OaYFqeMWo3paWpXcX/Dw8887XGYjYXbbh8aE2kyuQmq8X oE+/PRHFA6D1PXdCkmmM0DJvRlJjSyXuef4AyQ91QVFgscxlOr7z2rUFsZrPHiY48JUH tGVA== X-Gm-Message-State: ANoB5plaVqa8VmEJ3Un1pMWWOz7uL75g1tcqw8f69FBglvw33jiMdjBo ybAg6GcQo8obdOBBoVcQijepDZTWUko9psS+Ak70FF+BI3RVrhZozasgiUp/GFQVXBG+WKDTkKF rRv7fO0BqpsNQ84uZgVr6lfxUYM9dJUQBZqiufdRr X-Received: by 2002:a81:c86:0:b0:3f0:3355:86f2 with SMTP id 128-20020a810c86000000b003f0335586f2mr17786210ywm.88.1670975636972; Tue, 13 Dec 2022 15:53:56 -0800 (PST) X-Received: by 2002:a81:c86:0:b0:3f0:3355:86f2 with SMTP id 128-20020a810c86000000b003f0335586f2mr17786202ywm.88.1670975636731; Tue, 13 Dec 2022 15:53:56 -0800 (PST) MIME-Version: 1.0 References: <20221213234505.173468-1-npache@redhat.com> In-Reply-To: From: Nico Pache Date: Tue, 13 Dec 2022 16:53:30 -0700 Message-ID: Subject: Re: [RFC V2] mm: add the zero case to page[1].compound_nr in set_compound_order To: Mike Kravetz Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, muchun.song@linux.dev, akpm@linux-foundation.org, willy@infradead.org, gerald.schaefer@linux.ibm.com, sidhartha.kumar@oracle.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 Hi Mike, Thanks for the pointer! Would the branchless conditional be an improvement over the current approach? I'm not sure how hot this path is, but it may be worth the optimization. -- Nico On Tue, Dec 13, 2022 at 4:48 PM Mike Kravetz wrote: > > On 12/13/22 16:45, Nico Pache wrote: > > Since commit 1378a5ee451a ("mm: store compound_nr as well as > > compound_order") the page[1].compound_nr must be explicitly set to 0 if > > calling set_compound_order(page, 0). > > > > This can lead to bugs if the caller of set_compound_order(page, 0) forgets > > to explicitly set compound_nr=0. An example of this is commit ba9c1201beaa > > ("mm/hugetlb: clear compound_nr before freeing gigantic pages") > > There has been some recent work in this area. The latest patch being, > https://lore.kernel.org/linux-mm/20221213212053.106058-1-sidhartha.kumar@oracle.com/ > > -- > Mike Kravetz >