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=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 D638BC433FE for ; Fri, 11 Dec 2020 21:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A01D523372 for ; Fri, 11 Dec 2020 21:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393259AbgLKUrM (ORCPT ); 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-Google-Smtp-Source: ABdhPJxbsWIutx2ZXevFhUAFiR9hLO0CDJUZvI4JvpmqbMk3z2GrL9YO9ZP74P1vtIzNT8645EkAqg== 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