Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1582077pxu; Sat, 12 Dec 2020 18:47:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJ2PFQuQ2gdBhaazrrZ4bQdIucQJRQww6PF5HUg+c2FJgVJtRwIhwtqD8dh6IJmzc+CZL5 X-Received: by 2002:a17:906:b793:: with SMTP id dt19mr17183146ejb.120.1607827653907; Sat, 12 Dec 2020 18:47:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607827653; cv=none; d=google.com; s=arc-20160816; b=yiFEKqTGG9e5gMBzz2OId9VcD1dwBc/RRBp9QTT0OhtvjFJbgEJsnNxevThQ9CqnBv d9/RnfTqwcvu4I8FLPrPeFQbJLWV/YY+T+ALDdVgRLKr2visTLS//h+iatNPjlNtpyZZ tQA4DyvZPDVjCCBJgbcMzf3TwAqfBu51rgdnjJ1I2GCbHgWsNDv4Z6eBoO4w1ZEJoFJS Ty9bTcXmIc6hpacm7pw1GvGT43ZZI8XPsi38kDMIO+glaU4J9J3WZkPJr5x1yquxy4aS mpkJVAosWUnZtcRuua1nyJNwHVaeYxiWIOjCwh9iY1G2hI+lXmxGjwgslv6T03lgUPxd DVdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=E6ZVINXPsdzUvTi8y4F5dCQAcZ1z+AuX7onsYghdXXU=; b=xVab0HS5jQrUHDivtdr1EafYvgqLSlyKn/o5yWkTp0fN9SVTZKf3XHKhJ2YDn6zVbD 4qKMF4l2S3v3iBVX6/rd58lTquB2L5J0niVjwt7PiWOqZ2K0IQHW2Rcxishpmsk0DSJG 5mm6nGx0M7uZWOvC/tH+sL3n+bc54SVE0c/oXL/BhAJS3QpyLO33oWRedP9t/K3yvpVN IXflcvrkCK5MkyyRTcSnjFJA3cDuF0a9XNev3mv87xW2sBid5I+dmyYq5UFai1YGrnDa dTDvL9YFaag5v9I2nu+tPlrBGCx/QHl27KbtkO28UPPXSZg5SMO7WGltn4wtXY4dhF7H D+Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=QWWiLxi3; 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 h22si7468252ejd.179.2020.12.12.18.47.11; Sat, 12 Dec 2020 18:47:33 -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=@soleen.com header.s=google header.b=QWWiLxi3; 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 S2392488AbgLKUnM (ORCPT + 99 others); Fri, 11 Dec 2020 15:43:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389233AbgLKUmP (ORCPT ); Fri, 11 Dec 2020 15:42:15 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C3CC061793 for ; Fri, 11 Dec 2020 12:41:35 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id g20so14169578ejb.1 for ; Fri, 11 Dec 2020 12:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E6ZVINXPsdzUvTi8y4F5dCQAcZ1z+AuX7onsYghdXXU=; b=QWWiLxi3n5qfdFyONIr2q2ssLsNW2+Y/Fm1gJOa6KJ7O8TwqDxIC5alcqwk19dNRU1 PR3OJwLyy5Jl5QhBlZHCjStP2IOafpHAz3NLC8JC9kPe7FpNLPfNUCDlYPIiXTISHk/6 RVXF0IoaSYhxySEwGA8a9hR7gkHaIBXb5cajEi8huBPeKDeLIjiPB/lPsn4vYoO8833X 2fTjd4tRTNVBdPAItaDY7n8FmYGNK1mCyevS45WNvav8qR0fI5a8Hirkg3gHPlFy6puK X3++oIucgL1it8TgHK8uRisl6iSIAIBh+gx/ewyDkrAbZwOt91TUqQd+wmIvPOxitsXT FX7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E6ZVINXPsdzUvTi8y4F5dCQAcZ1z+AuX7onsYghdXXU=; b=qSLwvtkj2KPMsBfc3Q/QXjwj2Uqw+q+xFc5Zi9z6pvHuhBQUNR7CfqhUMNUp6ytEEV jp/k0S9kp4YznAT4636wIpY6+IkQ/AZ0Quo7YMlqHYBboUFmUjXuT4Y1pGnSovHfLxjP W+3EXyYvViZpIlgl4DVk7BrsWn7wuKpDQ+ytha77hYQ9JOM8ERt26DR8FY51TfJMvoSZ waTZ2lHCc4pbOJDbVzOrVDRgaSSq70+P/IqRDOeogN5gq05OsC2qC9YFvYe1dBEkEddN KUhpkTHV/McKTbcJpbJR/ECdmiUm53UQhodLjY+PH9Is5hikUg7jCZU5L2lNoChxqYoF V3YA== X-Gm-Message-State: AOAM532nF1kTBvDjS0b6fWu5gZ2HgieXzqnK/8WWc1AYM1f8kvGhTr57 tUVVLrCLYJ7PgGzBdS5wmsWKRQvAOHOiboYVEEji3Q== X-Received: by 2002:a17:906:5213:: with SMTP id g19mr8813843ejm.383.1607719293747; Fri, 11 Dec 2020 12:41:33 -0800 (PST) MIME-Version: 1.0 References: <20201211202140.396852-1-pasha.tatashin@soleen.com> <20201211202140.396852-6-pasha.tatashin@soleen.com> <20201211202354.GA2225686@ziepe.ca> In-Reply-To: <20201211202354.GA2225686@ziepe.ca> From: Pavel Tatashin Date: Fri, 11 Dec 2020 15:40:57 -0500 Message-ID: Subject: Re: [PATCH v3 5/6] mm/gup: migrate pinned pages out of movable zone To: Jason Gunthorpe 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Jason