Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3380464rdh; Thu, 28 Sep 2023 09:56:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEo5ZmO99s+N8umzIVTPZyzv429HpctQW/CMRVFbTqtZ9jxgXuCVMgYBHm2ZXg113qp+NxF X-Received: by 2002:a05:6871:811:b0:1c0:3110:12cc with SMTP id q17-20020a056871081100b001c0311012ccmr1900209oap.55.1695920184569; Thu, 28 Sep 2023 09:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695920184; cv=none; d=google.com; s=arc-20160816; b=PS9+LwlPZyJrfs5xcN8ONgbAaFO9e9Ki9sG1++mKnHZ47HI0CqCtfnr2+zLOFfLegI 5NX3WHPOtH/Fyqfee6wfn9pFOd4ALtqltcRStZcS0wRbVMuPM1TN1JdH342tIF716L+T Knwfk9G7vl3d+qEOieOrSyIJ/0x8OsxdCS62g3jNq1Jz/QA1hAGih2733rJxvMzKOGo9 j/0E4i0QZhNz0DFefmHh4U3/1LunLJapezLLfLcu5ZlfQycZLpP0KuKI6VwvJOFCQRlE /ut0EerM8WZCqXMm539YBigaaSvHEhMM9NaEQ4e5P0vKEGxqiZfurIE9nbizkNOYs1RL 4leA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=NDF7CH8bTKhRjSz3An4kXrtZKcHrytXsVm7QLB4Bnu4=; fh=k3fGMlYxyRbu4gkuFfhOXsHs4QdlSWLHwbWXcC3pdjo=; b=XFxsPDApv+CrnnJI6/dMw/c5gGAO82y2IgRviDZ88kbF3hkDmvuZg0iFSYUhzbfUXD QOKJLyoXgiYflFK0MLlnER3xoqcFQT4R3t4aihbPYtkZhYH7DHhHFDihmzvnY2ULZx6S L3xGGHmzNBe1R7gsn0tQealc1I4OlElLdiIiDQLF728G4zm2OHdmmKXFD/ARYD32wzn9 j30Ua1oWpqpbBICTWmJcO1soCrFYTh1kzvLHJpRvlvrF7fQgOasr4tusF//m+GL6lYRB jRHGuBiCcWB6QSTiMz4TFO4lOsrrtoUc+W+kJoFeqEvykR6Ccgll5KbNn3e8ru7Wt0DS GVgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZnCRavtR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 19-20020a631753000000b005789f94cd34si18893923pgx.636.2023.09.28.09.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 09:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZnCRavtR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 431B58129AF7; Thu, 28 Sep 2023 00:51:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231158AbjI1Hu5 (ORCPT + 99 others); Thu, 28 Sep 2023 03:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbjI1Hu4 (ORCPT ); Thu, 28 Sep 2023 03:50:56 -0400 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 32C9392 for ; Thu, 28 Sep 2023 00:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695887414; 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=NDF7CH8bTKhRjSz3An4kXrtZKcHrytXsVm7QLB4Bnu4=; b=ZnCRavtRgZ7ZIbx1nPWP5q9WnoIf87GTAz9bsVolyMpteIav+eH64yIpJwdAHEncbN384t rVDpcbAsspMtXk+mOLwQBa4Pe26pOuQ79TvMjyTmkFJKLdgNJ9HCHynyzGyQedTHccL1fb kDHYXhN9xQ8gL5gaNiO3W2ZI0OaMWJc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-307-GL0GjoedOkilqIBhd60-qQ-1; Thu, 28 Sep 2023 03:50:08 -0400 X-MC-Unique: GL0GjoedOkilqIBhd60-qQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E3953C40C06; Thu, 28 Sep 2023 07:50:08 +0000 (UTC) Received: from file1-rdu.file-001.prod.rdu2.dc.redhat.com (unknown [10.11.5.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B67B32156702; Thu, 28 Sep 2023 07:50:07 +0000 (UTC) Received: by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix, from userid 12668) id A104730C1C0A; Thu, 28 Sep 2023 07:50:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix) with ESMTP id 981B63FD4B; Thu, 28 Sep 2023 09:50:07 +0200 (CEST) Date: Thu, 28 Sep 2023 09:50:07 +0200 (CEST) From: Mikulas Patocka To: Paolo Bonzini cc: "Kirill A. Shutemov" , Andrew Morton , Mel Gorman , Vlastimil Babka , David Hildenbrand , quic_jhugo@quicinc.com, snitzer@kernel.org, dm , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/10] Fix confusion around MAX_ORDER In-Reply-To: <3c25ec6f-cd33-9445-a76f-6ec2c30755f5@redhat.com> Message-ID: <86e7f97a-ac6b-873d-93b2-1121a464989a@redhat.com> References: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> <3c25ec6f-cd33-9445-a76f-6ec2c30755f5@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=1.2 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_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 00:51:01 -0700 (PDT) On Wed, 27 Sep 2023, Paolo Bonzini wrote: > On 3/15/23 12:31, Kirill A. Shutemov wrote: > > MAX_ORDER currently defined as number of orders page allocator supports: > > user can ask buddy allocator for page order between 0 and MAX_ORDER-1. > > > > This definition is counter-intuitive and lead to number of bugs all over > > the kernel. > > > > Fix the bugs and then change the definition of MAX_ORDER to be > > inclusive: the range of orders user can ask from buddy allocator is > > 0..MAX_ORDER now. I think that exclusive MAX_ORDER is more intuitive in the C language - i.e. if you write "for (i = 0; i < MAX_ORDER; i++)", you are supposed to loop over all allowed values. If you declare an array "void *array[MAX_ORDER];" you are supposed to hold a value for each allowed order. Pascal has for loops and array dimensions with inclusive ranges - and it is more prone to off-by-one errors. Mikulas