From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [RFC PATCH 00/19] mm: Introduce a cgroup to limit the amount of locked and pinned memory Date: Tue, 31 Jan 2023 10:03:11 -0400 Message-ID: References: <6369225e-3522-341b-cd20-d95b1f11ea71@redhat.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6aW5CjZCKEWPOM6s1Er0FBASkHjiq7mAYmv2yOpE9ts=; b=QgI7MtzolMUfMjKEcSx7V23hVVbZ0h9tjIglCxYu1iQUVpgZHm/DxL8uNmQfIGwqH6zsVpn7XT9BzKQhWi6qnNf/JotK2rpUYQEx1LSH0ZxZzRFVLy0lLz0Al4mj9IOT+QjwA0TxbIMA4pnCvDdkeL/DvrFO7X422JcFxLD2GCKz+2QI+akECiOu43sjbMWHaNHSR4DpLKDGaZ4Sx2oj1bRhmOea8286cZtRRPyYnOCZUm+D4y5O+m4jtBDVmiWcdmecrn/HoWeuZHKotyvNf14YzR4x6OU6c/lCjmcapO0LYRpvTglxZO5yDMyKTrylV9XKuc1l8s6NoGXYVnJLPQ== Content-Disposition: inline In-Reply-To: <6369225e-3522-341b-cd20-d95b1f11ea71-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Hildenbrand Cc: Alistair Popple , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, jhubbard-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, tjmercier-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, mkoutny-IBi9RG/b67k@public.gmane.org, daniel-/w4YWyX8dFk@public.gmane.org On Tue, Jan 31, 2023 at 02:57:20PM +0100, David Hildenbrand wrote: > > I'm excited by this series, thanks for making it. > > > > The pin accounting has been a long standing problem and cgroups will > > really help! > > Indeed. I'm curious how GUP-fast, pinning the same page multiple times, and > pinning subpages of larger folios are handled :) The same as today. The pinning is done based on the result from GUP, and we charge every returned struct page. So duplicates are counted multiple times, folios are ignored. Removing duplicate charges would be costly, it would require storage to keep track of how many times individual pages have been charged to each cgroup (eg an xarray indexed by PFN of integers in each cgroup). It doesn't seem worth the cost, IMHO. We've made alot of investment now with iommufd to remove the most annoying sources of duplicated pins so it is much less of a problem in the qemu context at least. Jason