Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1583084pxu; Sat, 12 Dec 2020 18:50:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJygzSRf44qdXfryHJfiS+OoED4fzL2WTra/bN+JR4tsVAHj56kRshTxGvgEJSmqfSfCR6pH X-Received: by 2002:a17:907:271c:: with SMTP id w28mr17427882ejk.140.1607827846427; Sat, 12 Dec 2020 18:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607827846; cv=none; d=google.com; s=arc-20160816; b=LcXjR3IjkiL5qIxAuEOaBNwmhMW3Fh4s20SfBol+Z43RLWsbeIXhWLyUg9/FEWWUuJ w4NQJ+0nXeqXHjYZlb3vNt7R0yjMHiidWhpaxvzuF+h6ERWbVoZvQ7pB1d/Ilo3Ecu+b gwOw2ciS4wzth7WeJj1QWfzlEEmyd4mA3zRnd3eya7GX9qJa06LEQEbldE+XRDhdld64 CaYNcfdy0FJZCLGjPkWlKfcxsUWi66N0Amn0CGswsDsv6tKlOfVqwq0B0iXtBh/GWcf8 GPnYUOW71uQH1m/FjPuFBua7VOSz8fjBN8O4UDRn9v4Ha3bGhH+mZpVB++zJxgXVXjah XoRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YXtEoE581YUNSHu+/NxZZ3pnhpBfG2V2HyRoKL/oTq0=; b=YzIU2pci/9hAeKKXdWGX5Kx9X6qrZra1dLXy/0jbsv14SHPbfytPIfEpeTuVcf1sr5 SaPL2aVkEbIwkduQfzVexA2+rlKNSvOcTFZ9JZWTuAAIvdlCMTvSVck28ZHGRWxaaFJU PomSX1moSGIKNa3IWWsmWiPPlxDBnwBmYbtwNwA47gAAt/F5ljp+/iIK1DFA0BBB0lO8 SWSgzQP1PuSITZe5rTtci/iPJzo6rNZQi8PUsKe1+71ey7ZSV2RWyowlwbWUJxqOD/z6 xjgYajdXA17s5EZFFjuI0X2288c91fvxrN2Q+1JFS39BaZHdyhTZfR1Dvy8A7s55tuJ6 ufkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Lnf+QdvZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si7039548ejw.42.2020.12.12.18.50.24; Sat, 12 Dec 2020 18:50:46 -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=@ziepe.ca header.s=google header.b=Lnf+QdvZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392992AbgLKUrM (ORCPT + 99 others); Fri, 11 Dec 2020 15:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389774AbgLKUrA (ORCPT ); Fri, 11 Dec 2020 15:47:00 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75F4C0613D3 for ; Fri, 11 Dec 2020 12:46:19 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id c7so9819072qke.1 for ; Fri, 11 Dec 2020 12:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YXtEoE581YUNSHu+/NxZZ3pnhpBfG2V2HyRoKL/oTq0=; b=Lnf+QdvZHkkYbUNtmc8VetMlnpO1+1xWURXAJ8HA1AV7GWntmjPeb8eetKY6NU5cO4 kO31w4MtFS+OtNViirqirNOnghwHx8vLfahND2WN0+a/GXqLvE3JLUUioZC4uSntITDx e89soNGLUmhRnBsdRszXeJnrc6siegAHCd0sy37L/vt0SGWwD+LixT2ev9nnahsGxMZH iSju4VSpnKgQZEs3sK4gdVkzrsL036MsVf6s2qowh+j0/OHFB7kZMpc25GhJ6Knnbqgf KmCgddvHT9jt3rIlFKh6EjIKMmTxyiZ8I/ojY9ri/K73oj5izufcfNk0FMiBep6hwrzS wabw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YXtEoE581YUNSHu+/NxZZ3pnhpBfG2V2HyRoKL/oTq0=; b=sI44dIZtvAx+NFWor66eN2aRESKmri15hJEw5CrxBlnZsZieGftw4yR3PiN47qBxrp hCY1JSK3Qw3TftxRyY/YN5AAq1T8rMlbpjkIAqQSEvifPQNrgAN48Kt5PC6nrFffoEZt lodPiTZneo0S6dNJv9RuyhO6TvZUjhF+ffXLFiJCEmXEwZbo0FVi8S/F4O9aevrbypgV 3emYf3enuMiRzdND3TQQ8EajMtDaQIfV4I2yIfNKcvMG79Sav5QMOAnp8Qvp4O7MgOFa vMBgXhYUELykpIijlGGpMFoofiLqWugqIpJkAnktWUYlxgtfGJN5B2qua3rswtU2gYvT vegQ== X-Gm-Message-State: AOAM532Quw12HW8XwvhaXGx+lKXitAOgsMbS2MxJ3bFNnFXS1eX2poFO 808BbrGEvFTO1zaGxNuKw4fl1g== X-Received: by 2002:ae9:ed41:: with SMTP id c62mr18189409qkg.111.1607719579205; Fri, 11 Dec 2020 12:46:19 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id e126sm8329652qkb.90.2020.12.11.12.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Dec 2020 12:46:00 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1knpIe-009Lqd-2s; Fri, 11 Dec 2020 16:46:00 -0400 Date: Fri, 11 Dec 2020 16:46:00 -0400 From: Jason Gunthorpe To: Pavel Tatashin Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard , Linux Doc Mailing List Subject: Re: [PATCH v3 5/6] mm/gup: migrate pinned pages out of movable zone Message-ID: <20201211204600.GD5487@ziepe.ca> References: <20201211202140.396852-1-pasha.tatashin@soleen.com> <20201211202140.396852-6-pasha.tatashin@soleen.com> <20201211202354.GA2225686@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 03:40:57PM -0500, Pavel Tatashin wrote: > On Fri, Dec 11, 2020 at 3:23 PM Jason Gunthorpe wrote: > > > > On Fri, Dec 11, 2020 at 03:21:39PM -0500, Pavel Tatashin wrote: > > > @@ -1593,7 +1592,7 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm, > > > } > > > > > > if (!isolate_lru_page(head)) { > > > - list_add_tail(&head->lru, &cma_page_list); > > > + list_add_tail(&head->lru, &movable_page_list); > > > mod_node_page_state(page_pgdat(head), > > > NR_ISOLATED_ANON + > > > page_is_file_lru(head), > > > @@ -1605,7 +1604,7 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm, > > > i += step; > > > } > > > > > > - if (!list_empty(&cma_page_list)) { > > > + if (!list_empty(&movable_page_list)) { > > > > You didn't answer my earlier question, is it OK that ZONE_MOVABLE > > pages leak out here if ioslate_lru_page() fails but the > > moval_page_list is empty? > > > > I think the answer is no, right? > In my opinion it is OK. We are doing our best to not pin movable > pages, but if isolate_lru_page() fails because pages are currently > locked by someone else, we will end up long-term pinning them. > See comment in this patch: > + * 1. Pinned pages: (long-term) pinning of movable pages is avoided > + * when pages are pinned and faulted, but it is still possible that > + * address space already has pages in ZONE_MOVABLE at the time when > + * pages are pinned (i.e. user has touches that memory before > + * pinning). In such case we try to migrate them to a different zone, > + * but if migration fails the pages can still end-up pinned in > + * ZONE_MOVABLE. In such case, memory offlining might retry a long > + * time and will only succeed once user application unpins pages. It is not "retry a long time" it is "might never complete" because userspace will hold the DMA pin indefinitely. Confused what the point of all this is then ?? I thought to goal here is to make memory unplug reliable, if you leave a hole like this then any hostile userspace can block it forever. Jason