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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A5F6CCA47E for ; Wed, 29 Jun 2022 23:31:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3FD18E0002; Wed, 29 Jun 2022 19:31:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEFA68E0001; Wed, 29 Jun 2022 19:31:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB8688E0002; Wed, 29 Jun 2022 19:31:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A94B48E0001 for ; Wed, 29 Jun 2022 19:31:34 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 742C9354EA for ; Wed, 29 Jun 2022 23:31:34 +0000 (UTC) X-FDA: 79632872508.26.50F93EF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id BCFAA180037 for ; Wed, 29 Jun 2022 23:31:33 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B2B1B82775; Wed, 29 Jun 2022 23:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AD79C34114; Wed, 29 Jun 2022 23:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1656545490; bh=EUtoD6mxDI6S48VU4JnwbI++d7sfQ0Ba+nGXTEVn3jI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ko/bDBvXxEcl48eumHeFgpRmNjd7wuaH7G0qP1t6sIobV5qNgwt9GvaQkmQ+8dLZe hKn2EQAupvKSihpNA1xULMkEVgDQpKd2GPIe2XSS8++/sO3ZQjzDOdGljxu/viVmyv Z6MSvOI4xrcShSRXxM7iYVplJ7VEnCGXQnVIYp5g= Date: Wed, 29 Jun 2022 16:31:28 -0700 From: Andrew Morton To: David Hildenbrand Cc: Alex Sierra , jgg@nvidia.com, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org Subject: Re: [PATCH v7 03/14] mm: handling Non-LRU pages returned by vm_normal_pages Message-Id: <20220629163128.7002f81b6346b2ed34d4d02a@linux-foundation.org> In-Reply-To: <269e4c6e-d6ee-bace-9fab-a9dcb4268d5a@redhat.com> References: <20220629035426.20013-1-alex.sierra@amd.com> <20220629035426.20013-4-alex.sierra@amd.com> <269e4c6e-d6ee-bace-9fab-a9dcb4268d5a@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656545494; a=rsa-sha256; cv=none; b=zBsnl3mlddDf/0Wbyy1lG8IjTgjUUN6SEuYjfA/F15VR7z5kl7J/b05TUXsyyVhmuJlcj4 pZfGfG+bz52IizW1AF9+hZjS2FtD1EhIdE9uP7LZCVhZrxKwJS1ST+Pb39TqIyYAeFB34a kXUa4XXgUcdyhY7k1SVTfMm2LJK6WOI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="Ko/bDBvX"; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656545494; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y/8Tcwj2JHfJtiAInmVIK5darQopRGrDkm7zS/DkC3k=; b=0Z/V2s0bB9cZBncpV05/SCEl5pj/sMXU/JJQewCVRRtJUYEq2pgGOJL0v2Z9SsiHX36zPn 00KwQrceocx1fVmvNk83CjL8+2A0h7Iz552EKjqLcF3z+Y1pwEZ8ijXUk5Pe1Dz8hb5nm2 IS/wJ0hpS6Wv505zO1aQ5kv3Urp9vsU= X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="Ko/bDBvX"; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam02 X-Stat-Signature: epqj5ik4k6w75ahe6awxste7fbd6nq7s X-Rspamd-Queue-Id: BCFAA180037 X-HE-Tag: 1656545493-882521 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 Wed, 29 Jun 2022 11:59:26 +0200 David Hildenbrand wrote: > On 29.06.22 05:54, Alex Sierra wrote: > > With DEVICE_COHERENT, we'll soon have vm_normal_pages() return > > device-managed anonymous pages that are not LRU pages. Although they > > behave like normal pages for purposes of mapping in CPU page, and for > > COW. They do not support LRU lists, NUMA migration or THP. > > > > Callers to follow_page that expect LRU pages, are also checked for > > device zone pages due to DEVICE_COHERENT type. > > Can we rephrase that to (because zeropage) > > "Callers to follow_page() currently don't expect ZONE_DEVICE pages, > however, with DEVICE_COHERENT we might now return ZONE_DEVICE. Check for > ZONE_DEVICE pages in applicable users of follow_page() as well." I made that change to my copy. > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@ -624,6 +624,13 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, > > if (is_zero_pfn(pfn)) > > return NULL; > > if (pte_devmap(pte)) > > +/* > > + * NOTE: New uers of ZONE_DEVICE will not set pte_devmap() and will have > > s/uers/users/ > > > + * refcounts incremented on their struct pages when they are inserted into > > + * PTEs, thus they are safe to return here. Legacy ZONE_DEVICE pages that set > > + * pte_devmap() do not have refcounts. Example of legacy ZONE_DEVICE is > > + * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers. > > + */ And let's regularize that comment placement? --- a/mm/memory.c~mm-handling-non-lru-pages-returned-by-vm_normal_pages-fix +++ a/mm/memory.c @@ -632,16 +632,16 @@ struct page *vm_normal_page(struct vm_ar return NULL; if (is_zero_pfn(pfn)) return NULL; + /* + * NOTE: New users of ZONE_DEVICE will not set pte_devmap() + * and will have refcounts incremented on their struct pages + * when they are inserted into PTEs, thus they are safe to + * return here. Legacy ZONE_DEVICE pages that set pte_devmap() + * do not have refcounts. Example of legacy ZONE_DEVICE is + * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers. + */ if (pte_devmap(pte)) -/* - * NOTE: New uers of ZONE_DEVICE will not set pte_devmap() and will have - * refcounts incremented on their struct pages when they are inserted into - * PTEs, thus they are safe to return here. Legacy ZONE_DEVICE pages that set - * pte_devmap() do not have refcounts. Example of legacy ZONE_DEVICE is - * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers. - */ return NULL; - print_bad_pte(vma, addr, pte, NULL); return NULL; } _