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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11322C77B7E for ; Thu, 25 May 2023 20:54:31 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QS0fZ3NJ7z3fHb for ; Fri, 26 May 2023 06:54:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=PRDb4uH8; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::112e; helo=mail-yw1-x112e.google.com; envelope-from=vishal.moola@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=PRDb4uH8; dkim-atps=neutral Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QS0dc1gPkz3fBm for ; Fri, 26 May 2023 06:53:38 +1000 (AEST) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-565a022ef06so2574387b3.3 for ; Thu, 25 May 2023 13:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048015; x=1687640015; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=e72vGCwhPoa8gN25X6qmdDXVUsdWWJFQx8MjqDcoGDA=; b=PRDb4uH8g3Vv6gZWsZ1gkHY+ANMWnqtSqEQNi+t68NKJyRAPGtGIjXS+o6ABKHZ7yv q51K7Vr8Q1brsvSZQkdt4WeLJo6vXr04Grr6RxGrB/PY5E3pp1cBQWvGni0wb9TWYIbM 5FWOkPlw4M42rE2TxcMBGldDhB3WLqb55j0CqgwQEW0TmVHxxCeHx2Zs7VLCqGumlN8c PmQWTAjBOIMu7fHadjtAjQF7IDQQLa3x/OUyFY2aJiBpGADt0K07OCNxrHer3KqiVV69 GxawL7cJdKwcX3ZUAGYa8EVBTKoLWza/yXtntrwGkP8KyxHL6U40gF5XovIoxt2V2Fr9 5Wvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048015; x=1687640015; h=content-transfer-encoding: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=e72vGCwhPoa8gN25X6qmdDXVUsdWWJFQx8MjqDcoGDA=; b=kJADxOuNy2GSPrpJ2oI2Myq+a77E7QQdX44htIlT2Mg8sHmy4d3RUnpgBm7uG6oEW0 d+2RV8gFtHIJvT52hjgQpAyf7Xr7ZpFEaENWlqegs492SP02Y46X62jHWPsT8/RM3brQ e5kqoiwxnynSnoMQ8f1HUYfhYGBTUGBBJVH7cEBCRvNuNWau2WCTFuuX9rHgl6lqsYyY KPF0g6S5xr1744ZatUe7J4h+16heCRlfbB1ofsd2fZE9c1IxvsNPpy+z5/+PJsid07al 7+2qQA+6f9bbwHsekzc6rxgXsooKSBNKCg6hYoXG90PGl5BHZes2/5s+C8UgE0avGTR4 hBzw== X-Gm-Message-State: AC+VfDyPLo4lLzCU29i+DVNOR/FSaabDvVS+2B2LUIMFkTzfeVpYUW7h WBgk1ICOo4sNIwMMyw8gtv0DU/nIfG2IgxICSg4= X-Google-Smtp-Source: ACHHUZ6an6zID91jt8f3LQ4QGAvFJ9u++x53xf0fSCLXe0WivFCmGXJlgIcqvJgo7KICituWVYFJf3qgdSw5/O75Zdg= X-Received: by 2002:a81:4810:0:b0:55a:84c9:e952 with SMTP id v16-20020a814810000000b0055a84c9e952mr1013445ywa.17.1685048014974; Thu, 25 May 2023 13:53:34 -0700 (PDT) MIME-Version: 1.0 References: <20230501192829.17086-1-vishal.moola@gmail.com> <20230501192829.17086-6-vishal.moola@gmail.com> <20230525090956.GX4967@kernel.org> <20230525202537.GA4967@kernel.org> In-Reply-To: <20230525202537.GA4967@kernel.org> From: Vishal Moola Date: Thu, 25 May 2023 13:53:24 -0700 Message-ID: Subject: Re: [PATCH v2 05/34] mm: add utility functions for ptdesc To: Mike Rapoport Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, linux-mips@vger.kernel.org, linux-csky@vger.kernel.org, linux-mm@kvack.org, linux-m68k@lists.linux-m68k.org, Matthew Wilcox , loongarch@lists.linux.dev, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, May 25, 2023 at 1:26=E2=80=AFPM Mike Rapoport wro= te: > > On Thu, May 25, 2023 at 11:04:28AM -0700, Vishal Moola wrote: > > On Thu, May 25, 2023 at 2:10=E2=80=AFAM Mike Rapoport = wrote: > > > > + > > > > +static inline struct ptdesc *ptdesc_alloc(gfp_t gfp, unsigned int = order) > > > > +{ > > > > + struct page *page =3D alloc_pages(gfp | __GFP_COMP, order); > > > > + > > > > + return page_ptdesc(page); > > > > +} > > > > + > > > > +static inline void ptdesc_free(struct ptdesc *pt) > > > > +{ > > > > + struct page *page =3D ptdesc_page(pt); > > > > + > > > > + __free_pages(page, compound_order(page)); > > > > +} > > > > > > The ptdesc_{alloc,free} API does not sound right to me. The name > > > ptdesc_alloc() implies the allocation of the ptdesc itself, rather th= an > > > allocation of page table page. The same goes for free. > > > > I'm not sure I see the difference. Could you elaborate? > > I read ptdesc_alloc() as "allocate a ptdesc" rather than as "allocate a > page for page table and return ptdesc pointing to that page". Seems very > confusing to me already and it will be even more confusion when we'll sta= rt > allocating actual ptdescs. Hmm, I see what you're saying. I'm envisioning this function evolving into one that allocates a ptdesc later. I don't see why we would need to have bo= th a page table page AND ptdesc at any point, but that may be a lack of knowledg= e from my part. I was thinking later, if necessary, we could make another function (only to be used internally) to allocate page table pages.