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=ham 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 507DEC4361B for ; Fri, 11 Dec 2020 20:46:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B95702405A for ; Fri, 11 Dec 2020 20:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B95702405A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E816E6B0036; Fri, 11 Dec 2020 15:46:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0B4C6B005C; Fri, 11 Dec 2020 15:46:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFBE46B005D; Fri, 11 Dec 2020 15:46:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id B6A926B0036 for ; Fri, 11 Dec 2020 15:46:20 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 77B8B181AF5CC for ; Fri, 11 Dec 2020 20:46:20 +0000 (UTC) X-FDA: 77582184120.17.truck85_3c17cb127403 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 5DBDF1812EDBA for ; Fri, 11 Dec 2020 20:46:20 +0000 (UTC) X-HE-Tag: truck85_3c17cb127403 X-Filterd-Recvd-Size: 6456 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Dec 2020 20:46:19 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id n142so9785049qkn.2 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=YJ66bgHfVSmEE69pGi5Xol8fFL9s/i5UG9ddZHI3YNXFRzlUXaPclkd3Egwvo5NaMB Z9ik2WiVf9j0VBpxoHSNyc0+ctMW1AWcZ1XgOLBOgOxw/nrsdcUXah8NH8KohQnoxHwC G3cZ8YW385EKkrmy9gcaoumJSe+j3yQPTyFAgj/GlgM/LFGq0HA16WEsUW+B6AeA3gZ+ oSaqlTcRANQYXaPFLbbMTzZxACSRiK1XUpfBIrZS1zWlYTiYyauiiUdtiO7qeYQM3EUu +MuwlrbLQv/4MFVWeTB5ESiSSthM0zcB05/VMDxKt3SOvjytjm5pKHhtz+9od723al0L Btag== X-Gm-Message-State: AOAM532E1mPiYI30RUEZpL+3FI3JVzhie8hkkbK2dzrlhkmsBIyBKRGM MHodInpqLWb0J64svpUfrnVewg== 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: 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 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