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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 E6CA7C433E0 for ; Wed, 13 Jan 2021 20:06:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 378A0208B8 for ; Wed, 13 Jan 2021 20:06:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 378A0208B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 834758D0093; Wed, 13 Jan 2021 15:06:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E3AC8D008E; Wed, 13 Jan 2021 15:06:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AC278D0093; Wed, 13 Jan 2021 15:06:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 51BED8D008E for ; Wed, 13 Jan 2021 15:06:19 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 109BD1EFD for ; Wed, 13 Jan 2021 20:06:19 +0000 (UTC) X-FDA: 77701833678.03.mint06_171592827520 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id DC6E828A4E8 for ; Wed, 13 Jan 2021 20:06:18 +0000 (UTC) X-HE-Tag: mint06_171592827520 X-Filterd-Recvd-Size: 5499 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 13 Jan 2021 20:06:18 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id b9so4930166ejy.0 for ; Wed, 13 Jan 2021 12:06:18 -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=Atsr5jv8T9ZoJtbPK6SL546tOdJtaCS1oan7zJwQQ90=; b=oGlnGhdttfZH9cF4FbW4sCgfSGQ6U3mer6sHR5EOFTWOBqoeG6j+KtZq2twcU7HQ9J Nt1hwbL0wlFnzlGS0w028VPAJIMiUNwg+wEqndnRf+hnPIe9yvXiwV+wuTMSKENjUfh4 MhknEf3Zwn49LELA6GqYdRZOKNdzfAvfjihOR9IUwvoIfyCABq0fSz3LvD/nvTz7LB42 LpojBCPMJUBK9Cpl2HW4MYyAygvOdjb/FTq9NarqiB1GNz1kYUE0SZHFwduExzCZUmt/ EJWa2bwDWYTWm4Lsf/nSXzs8l25MC4Dvet1uuwLH0ZGaqgNIJLXkrTuaucVVY4tUMwxD 9jRg== 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=Atsr5jv8T9ZoJtbPK6SL546tOdJtaCS1oan7zJwQQ90=; b=axtMgJI1vFPz2m+AxI+wXB0hC3TTM8WiLutzuMar3zMplh94NZM9ovmLoYPAX7aPeF UWjN/ErLpwcqg8OMGr3NnZu0MB/VkY8muxuBk+Frj5XzwFZSkHKUP+5WFQ0TBBgb8qOY dlvm35rOY3xjSC30NfWSr/4uIzPcwcItWgApBOdFJzJtAYJpGy7sX0zZQv5DqHo+LV/f NI3NSNnxwiDIYbez89keUx47mKMuyZVbPasv2gV0+4kFmEYGGFdhI0Pec7E8ezfa5lTI Qq8Tv9G6jQ6F8Yh/ILKg7TYk2CVw+P5CNE6xm/6em13wE6xZUMyQG1JlNrqCkCiUVCuN 9laQ== X-Gm-Message-State: AOAM5338rQl6sLLewut1G9OYslVo6y0wAesOqctaGASVUN88NR43wPl7 xY8zWhhNsamFvD72uQNEPGoN3pKR/s2Gl4HBa4MpHQ== X-Google-Smtp-Source: ABdhPJzUDzmZWA4lqsW8yXocmHnZp0KlbLU4jdTw5S1s0d7cWUsk+k6/wu+RPxqCYR56z3F8bKI2HBHwXfb+qrUg82Y= X-Received: by 2002:a17:907:1b27:: with SMTP id mp39mr2546538ejc.519.1610568377144; Wed, 13 Jan 2021 12:06:17 -0800 (PST) MIME-Version: 1.0 References: <20201217185243.3288048-1-pasha.tatashin@soleen.com> <20201217185243.3288048-9-pasha.tatashin@soleen.com> <20201217205048.GL5487@ziepe.ca> <20201218141927.GM5487@ziepe.ca> <20210113195528.GD4605@ziepe.ca> In-Reply-To: <20210113195528.GD4605@ziepe.ca> From: Pavel Tatashin Date: Wed, 13 Jan 2021 15:05:41 -0500 Message-ID: Subject: Re: [PATCH v4 08/10] mm/gup: limit number of gup migration failures, honor failures 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 , Ira Weiny , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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: > > > Oh, that existing logic is wrong too :( Another bug. > > > > I do not think there is a bug. > > > > > You can't skip pages in the pages[] array under the assumption they > > > are contiguous. ie the i+=step is wrong. > > > > If pages[i] is part of a compound page, the other parts of this page > > must be sequential in this array for this compound page > > That is true only if the PMD points to the page. If the PTE points to > a tail page then there is no requirement that other PTEs are > contiguous with the compount page. > > At this point we have no idea if the GUP logic got this compound page > as a head page in a PMD or as a tail page from a PTE, so we can't > assume a contiguous run of addresses. I see, I will fix this bug in an upstream as a separate patch in my series, and keep the fix when my fixes are applied. > > Look at split_huge_pmd() - it doesn't break up the compound page it > just converts the PMD to a PTE array and scatters the tail pages to > the PTE. Got it, unfortunately the fix will deoptimize the code by having to check every page if it is part of a previous compound page or not. > > I understand Matt is pushing on this idea more by having compound > pages in the page cache, but still mapping tail pages when required. > > > This is actually standard migration procedure, elsewhere in the kernel > > we migrate pages in exactly the same fashion: isolate and later > > migrate. The isolation works for LRU only pages. > > But do other places cause a userspace visible random failure when LRU > isolation fails? Makes sense, I will remove maximum retries for isolation, and retry indefinitely, the same as it is done during memory hot-remove. So, we will fail only when migration fails. > > I don't like it at all, what is the user supposed to do? > > Jason