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=-9.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 6C165C433DF for ; Mon, 27 Jul 2020 15:10:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 34CD920672 for ; Mon, 27 Jul 2020 15:10:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34CD920672 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A896B6B0002; Mon, 27 Jul 2020 11:10:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EADD6B0003; Mon, 27 Jul 2020 11:10:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D9A66B0005; Mon, 27 Jul 2020 11:10:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 76FD16B0002 for ; Mon, 27 Jul 2020 11:10:33 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2B6833626 for ; Mon, 27 Jul 2020 15:10:33 +0000 (UTC) X-FDA: 77084192346.10.grain02_2e14f0326f62 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 2034E16A63C for ; Mon, 27 Jul 2020 15:09:11 +0000 (UTC) X-HE-Tag: grain02_2e14f0326f62 X-Filterd-Recvd-Size: 3501 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Jul 2020 15:09:10 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 88571B71A; Mon, 27 Jul 2020 15:09:19 +0000 (UTC) Subject: Re: [PATCH v3 4/4] xen: add helpers to allocate unpopulated memory To: Roger Pau Monne , linux-kernel@vger.kernel.org Cc: Oleksandr Andrushchenko , David Airlie , Daniel Vetter , Boris Ostrovsky , Stefano Stabellini , Dan Carpenter , Wei Liu , Yan Yankovskyi , dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, linux-mm@kvack.org, David Hildenbrand , Michal Hocko , Dan Williams References: <20200727091342.52325-1-roger.pau@citrix.com> <20200727091342.52325-5-roger.pau@citrix.com> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <06e21488-25a6-1c9f-366b-3c2ab63e4632@suse.com> Date: Mon, 27 Jul 2020 17:09:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200727091342.52325-5-roger.pau@citrix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 2034E16A63C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 27.07.20 11:13, Roger Pau Monne wrote: > To be used in order to create foreign mappings. This is based on the > ZONE_DEVICE facility which is used by persistent memory devices in > order to create struct pages and kernel virtual mappings for the IOMEM > areas of such devices. Note that on kernels without support for > ZONE_DEVICE Xen will fallback to use ballooned pages in order to > create foreign mappings. >=20 > The newly added helpers use the same parameters as the existing > {alloc/free}_xenballooned_pages functions, which allows for in-place > replacement of the callers. Once a memory region has been added to be > used as scratch mapping space it will no longer be released, and pages > returned are kept in a linked list. This allows to have a buffer of > pages and prevents resorting to frequent additions and removals of > regions. >=20 > If enabled (because ZONE_DEVICE is supported) the usage of the new > functionality untangles Xen balloon and RAM hotplug from the usage of > unpopulated physical memory ranges to map foreign pages, which is the > correct thing to do in order to avoid mappings of foreign pages depend > on memory hotplug. >=20 > Signed-off-by: Roger Pau Monn=C3=A9 > --- > I've not added a new memory_type type and just used > MEMORY_DEVICE_DEVDAX which seems to be what we want for such memory > regions. I'm unsure whether abusing this type is fine, or if I should > instead add a specific type, maybe MEMORY_DEVICE_GENERIC? I don't > think we should be using a specific Xen type at all. What about introducing MEMORY_DEVICE_VIRT? The comment for MEMORY_DEVICE_DEVDAX doesn't really fit, as there is no character device involved. In the end its the memory management maintainers to decide that. Other than that you can have my Reviewed-by: Juergen Gross Juergen