Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp638984pxb; Wed, 13 Jan 2021 12:08:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYOG4NGql+WI5dcrGgTyY1a1k1l15zXRGUVk6DMoFtMOmRB5gubyl8nV0u2wTTMryAKbAW X-Received: by 2002:a17:907:546:: with SMTP id wk6mr2739441ejb.238.1610568483919; Wed, 13 Jan 2021 12:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610568483; cv=none; d=google.com; s=arc-20160816; b=mqIicctm9lOjrlWEPk7mOGtHsAu3baTSh4dvHk77lQUB9rfpYRG8ZY3Ia/ZZrzxUWt A7+08m/lZT/Z8ZybFfWAL4tgJW7gNFGGPtV/nEzqsjB3ON7juxCg+sj38tQBtGFJD8TT UUnoXjp/g5v00hfMpT5VWVQk4aXO8YsQxAHG1wW2kGyh+b984NJNOQOVwEL0MXwhZoW+ zOj2B0bsaPVrT162+lcw6KY2H1BHNhoLHWKuwsbwt7kzSKHQTXHcsgstufQJHJkmkwzy wUqfRjCIwBWD3qxnhd6On8Wf03kUOQfUTwacPj7ZDMX2SMS5OdUEhA55GJTiz+JwO4Nz j6zA== 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=Atsr5jv8T9ZoJtbPK6SL546tOdJtaCS1oan7zJwQQ90=; b=wPhKJhrDn0oN94ar6irVm74Th4dXSquCOxhrahzFdU0Zr//alwyI5x6mXJU4Ob3PeU cQEog5hV3tFdtkk/KHVxLE2RNukCcBUCliFwdNpMdEeuQ099PwIM/pdka15rUPWnJUG7 0cFZLoEN8anUaH3/V2VuGrxN6abn8DJGRWATqkIhxompLJIyFOwCR1iOC/H5DaNyRPb6 rRsBDc/5ar9attYD9Ag3uiDE6tKIspQnv6soPIy05rQzVRbhj1WDfMvcm9hjyzKLI59N x1wQEm74Sf7OaQaV6lSm3vAZcYuUmJjxMSJIO+a3KeCaeC3ZtWkSmMwSLGIekIqfsn5/ Vb8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=oGlnGhdt; 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 t26si1348424eji.212.2021.01.13.12.07.39; Wed, 13 Jan 2021 12:08:03 -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=oGlnGhdt; 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 S1728763AbhAMUG7 (ORCPT + 99 others); Wed, 13 Jan 2021 15:06:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728734AbhAMUG7 (ORCPT ); Wed, 13 Jan 2021 15:06:59 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C241C061575 for ; Wed, 13 Jan 2021 12:06:18 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id hs11so2541953ejc.1 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=rBU6muUwbkC7ITheyLz2MpcQN2dQeqgbjK6GLMNhsvESLVceefOoVueyhPtR7DCSva BQ2WL8HwwSzIWkezJgV7gC5xhQWdvQMD/Dwuf/nVCBuA5Lg3aKF7xWtCc6c9zsK+ZjAE zmNrXwun2jr0XHuXPXk2Ev5u6NBP+WWc5xV5QqF/Wele7RE9DRTe/0QjbsfFwBvMBW1t fQlwKhpb+lFefo4Jqpxu4PU3xCfP8OKfl5bi+x36+oXzSPRxYfsYthZIKcI1b5glewRn KDpqh3A6MI+TYOydun8FlmvawZlXzS3vipQxMcqtWIilG/fsRVNTV2zH5OxYhsa+u0VX 60wg== X-Gm-Message-State: AOAM531/T8c8H9cjBIllnoBHu2uetNx4QTZVSV43B4CEjbjOVEglsI9n /rFCebL2RVQkKj3lnoCd5fSd9jVWloGCtMlxp1eeFA== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > 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