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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE613C4363D for ; Tue, 22 Sep 2020 15:27:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5FE9223A1B for ; Tue, 22 Sep 2020 15:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FE9223A1B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A25B5900068; Tue, 22 Sep 2020 11:27:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D5E190000F; Tue, 22 Sep 2020 11:27:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 912EF900068; Tue, 22 Sep 2020 11:27:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 7EFA190000F for ; Tue, 22 Sep 2020 11:27:10 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 351BD180AD80F for ; Tue, 22 Sep 2020 15:27:10 +0000 (UTC) X-FDA: 77291075820.18.money31_3b033e52714e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 09CDA100ED586 for ; Tue, 22 Sep 2020 15:27:10 +0000 (UTC) X-HE-Tag: money31_3b033e52714e X-Filterd-Recvd-Size: 2492 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 15:27:09 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 6CC1F67373; Tue, 22 Sep 2020 17:27:06 +0200 (CEST) Date: Tue, 22 Sep 2020 17:27:06 +0200 From: Christoph Hellwig To: boris.ostrovsky@oracle.com Cc: Christoph Hellwig , Andrew Morton , Peter Zijlstra , Juergen Gross , Stefano Stabellini , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Minchan Kim , Nitin Gupta , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Subject: Re: [PATCH 6/6] x86/xen: open code alloc_vm_area in arch_gnttab_valloc Message-ID: <20200922152706.GA30633@lst.de> References: <20200918163724.2511-1-hch@lst.de> <20200918163724.2511-7-hch@lst.de> <0833b9a8-5096-d105-a850-1336150eada1@oracle.com> <20200922145819.GA28420@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Content-Transfer-Encoding: quoted-printable 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 Tue, Sep 22, 2020 at 11:24:20AM -0400, boris.ostrovsky@oracle.com wrot= e: >=20 > On 9/22/20 10:58 AM, Christoph Hellwig wrote: > > On Mon, Sep 21, 2020 at 04:44:10PM -0400, boris.ostrovsky@oracle.com = wrote: > >> This will end up incrementing area->ptes pointer. So perhaps somethi= ng like > >> > >> > >> pte_t **ptes =3D area->ptes; > >> > >> if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, > >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= PAGE_SIZE * nr_frames, gnttab_apply, &ptes)) { > >> > >> =A0=A0=A0=A0=A0=A0 ... > > Yeah. What do you think of this version?=20 >=20 >=20 > Oh yes, this is way better. This now can actually be read without tryin= g to mentally unwind triple pointers. (You probably want to initialize id= x to zero before calling apply_to_page_range(), I am not sure it's guaran= teed to be zero). Both instances are static variables, thus in .bss and initialized. So unless you insist I don't think we need a manual one.