Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4786438pxu; Thu, 10 Dec 2020 05:35:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtr6sL4CstrRZ18tV0IVHWnpQ90EtKmf1Qveb/gt+j5jIajXg0vAcmX0ZNO9mgxWAGD5XE X-Received: by 2002:a17:906:174f:: with SMTP id d15mr6350126eje.15.1607607324282; Thu, 10 Dec 2020 05:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607607324; cv=none; d=google.com; s=arc-20160816; b=d5z+7Yb39YGHorxtTve8FgeJYLwQlpnZ1NY0foSygihjqucA18DRgJtvkxmmIXLoCs PtVcFIUMRg5w6QwU4UCejzPBF1nLFl49wSdOFjt18lKiLWzTQ1uV298vYPZY8Mn684D1 JQOTKrCOLL9Kb0RMCM9+jvL1dOqwAzvSXKumgYbXH2bRQME0J5S82QdyoH3MsGWciUod NsQLcdF86/2+3mkdiRl2SoJGIgVB08WkOeZE+hq2WAEqGIW9vEuIkxUD6Sy6TcIfXUAC ZVzmm2NZkG0n8M2erktUnhviqZ+lcS4KIdZR0T6GA9P2oovCgoGtbHyYBCe9ClMxsm/Z iP9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6Y1/pCcVVUBfv3HtE9L8Hpubgn3eVeV8xQvQ2V1/F7c=; b=BDZUba8ZDMbrCHUSD6Yq33ZBYSVFa/BtbZwaemBekZT2Ktrs5j9S0M6L7zYwTtE7LU NBT2+3R02QgBrbsQ1L90HkgMDvl/vGK+g2mwl/oxK1GygAzGrGITiAub0UnqI5TiHCLF LJNwSZSY/bY6oPQRiHQBmHlSb/EsVT3/4vIEaTxUR2rkbLh5aynA4hqCYFGuqbBf/9hW Gzyy1/3qow7NkWwheRn69lf/Ku5IST9SqLSCwvaUdsOLHUuluIY60q4JIHVGIqaqTb+m vzTf9vOsIkEJxSo1ZFEPt9g9KQtkRlSMgmyJbh9AuwDKXJIMbF8GXEDfU37MfHqefuM9 ZX5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pZ+LO5QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si2898700edv.254.2020.12.10.05.35.01; Thu, 10 Dec 2020 05:35:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pZ+LO5QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389111AbgLJNbS (ORCPT + 99 others); Thu, 10 Dec 2020 08:31:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389191AbgLJNa5 (ORCPT ); Thu, 10 Dec 2020 08:30:57 -0500 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3205CC0613D6 for ; Thu, 10 Dec 2020 05:30:17 -0800 (PST) Received: by mail-lj1-x244.google.com with SMTP id f24so6615239ljk.13 for ; Thu, 10 Dec 2020 05:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6Y1/pCcVVUBfv3HtE9L8Hpubgn3eVeV8xQvQ2V1/F7c=; b=pZ+LO5QJlGoNVILFpKMp61lgJEapSo4Muukuh4BzipvJOvo7UPK7aH63a8QDnxRBRu 8gdyFlum+HyecIZxcXR/tVzeSeV2oVn0hHElChzBWdkeHvdlIW8Uqs2ZMtiXeLcKboNX Y9pw53BAa+K9bojIdDQcBL5D0DZrr/6UGIexYlLoGWBd0WiRJ1UPLbUEQubEp1N4VijA fsy8eWPZrsVKpwlQrvd2Ah28UmLWQzk3zf+OVAsCzO6vSxuhAZzJzNgXNiE6ul7N25ON 5JOB4ki6qLEC3XbQz5lvH87lt82jzoD3/ApNDoff3s3m+a8G9rVKIfRbbg3mk3mUz+CY 0fwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6Y1/pCcVVUBfv3HtE9L8Hpubgn3eVeV8xQvQ2V1/F7c=; b=bFKxD3UVRJdkr1bNchNmhWtq0vYjPktst2xJNiNMxCNTqzfj74aERa7poHE0Z6XyCn MfaFAs+3A/okmJXsNEY+N4n4smrRM619dxf6xyUjnUosfNUZh9NJIkdqcpSGqpbMhELe A/p29Eq5gmymQjDParTu7J1stJBs0kl41p5Txc2DfGRT+kI5xS6HTFNPbRqYaZhnk2/P /D0dlYTXr8ojOcOlO4vTdlw4ObNKmVF0+Z8tjJrQ7KmWQ5MkBYwsqECXbEvsVnJGV0Zx SwaR23vkSwhv/XZYQ38VCYIrwkdSwSmgsFLUisUhPAu2m8Gu18/gPfQN9KQF8Sn7L1Ci vQ7Q== X-Gm-Message-State: AOAM531k4oIzlf2Y+GeXJDoCproGCcsevvNVEKPoYmnLQ3jcM6SO8Fmk hMMrrg0vevEd+RN08GKJBV10gsgjmORPTw65EU0= X-Received: by 2002:a2e:1657:: with SMTP id 23mr3024716ljw.12.1607607015736; Thu, 10 Dec 2020 05:30:15 -0800 (PST) MIME-Version: 1.0 References: <20201207133024.16621-1-jgross@suse.com> <20201207133024.16621-3-jgross@suse.com> <72bc4417-076c-78f0-9c7e-5a9c95e79fb2@suse.com> <20201210111454.dxykvyktzwr3fjyk@Air-de-Roger> <7425aed6-ff6f-873a-b629-b9c7058e9b13@suse.com> In-Reply-To: <7425aed6-ff6f-873a-b629-b9c7058e9b13@suse.com> From: Jason Andryuk Date: Thu, 10 Dec 2020 08:30:04 -0500 Message-ID: Subject: Re: [PATCH 2/2] xen: don't use page->lru for ZONE_DEVICE memory To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Cc: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , xen-devel , open list , Boris Ostrovsky , Stefano Stabellini Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10, 2020 at 6:40 AM J=C3=BCrgen Gro=C3=9F wro= te: > > On 10.12.20 12:14, Roger Pau Monn=C3=A9 wrote: > > On Tue, Dec 08, 2020 at 07:45:00AM +0100, J=C3=BCrgen Gro=C3=9F wrote: > >> On 07.12.20 21:48, Jason Andryuk wrote: > >>> On Mon, Dec 7, 2020 at 8:30 AM Juergen Gross wrote: > >>>> > >>>> Commit 9e2369c06c8a18 ("xen: add helpers to allocate unpopulated > >>>> memory") introduced usage of ZONE_DEVICE memory for foreign memory > >>>> mappings. > >>>> > >>>> Unfortunately this collides with using page->lru for Xen backend > >>>> private page caches. > >>>> > >>>> Fix that by using page->zone_device_data instead. > >>>> > >>>> Fixes: 9e2369c06c8a18 ("xen: add helpers to allocate unpopulated mem= ory") > >>>> Signed-off-by: Juergen Gross > >>> > >>> Would it make sense to add BUG_ON(is_zone_device_page(page)) and the > >>> opposite as appropriate to cache_enq? > >> > >> No, I don't think so. At least in the CONFIG_ZONE_DEVICE case the > >> initial list in a PV dom0 is populated from extra memory (basically > >> the same, but not marked as zone device memory explicitly). > > > > I assume it's fine for us to then use page->zone_device_data even if > > the page is not explicitly marked as ZONE_DEVICE memory? > > I think so, yes, as we are owner of that page and we were fine to use > lru, too. I think memremap_pages or devm_memremap_pages (which calls memremap_pages) is how you mark memory as ZONE_DEVICE. i.e. they are explicitly marked. memremap_pages memmap_init_zone_device (with ZONE_DEVICE) __init_single_page set_page_links set_page_zone grep only finds a few uses of ZONE_DEVICE in the whole tree. Regards, Jason