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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0B68C00140 for ; Wed, 3 Aug 2022 00:12:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E634D8E0002; Tue, 2 Aug 2022 20:12:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E11E98E0001; Tue, 2 Aug 2022 20:12:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D00F68E0002; Tue, 2 Aug 2022 20:12:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BD4928E0001 for ; Tue, 2 Aug 2022 20:12:20 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 76DAE120333 for ; Wed, 3 Aug 2022 00:12:20 +0000 (UTC) X-FDA: 79756354440.31.3E97BAA Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf07.hostedemail.com (Postfix) with ESMTP id E6EBB4010A for ; Wed, 3 Aug 2022 00:12:19 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E77CDB82011; Wed, 3 Aug 2022 00:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BC31C433D6; Wed, 3 Aug 2022 00:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1659485536; bh=j5DiZB7awx92wK0xf/+EzvYAorL6T6kj0ZX0XBRlF8I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EGn4PBf25k/O0WyCujaARDLi3ImjZPQnLCb8RLVnya4HGjSIYl57o9MM9zpftWr+v 0l8NttqRxekOg3CoUc6kLUguHLUw7XY+e+K4iqpBl5AojVbku9iBhId9pDYI5JVCay 1XX2dgTNnbCPgTzYdtuxcHbFMHNUDYmX9jPWDqtI= Date: Tue, 2 Aug 2022 17:12:15 -0700 From: Andrew Morton To: Alistair Popple Cc: linux-mm@kvack.org, jgg@nvidia.com, minchan@kernel.org, linux-kernel@vger.kernel.org, jhubbard@nvidia.com, pasha.tatashin@soleen.com, david@redhat.com Subject: Re: [PATCH v2] mm/gup.c: Simplify and fix check_and_migrate_movable_pages() return codes Message-Id: <20220802171215.3c909e1984ec345ff94af155@linux-foundation.org> In-Reply-To: <814dee5d3aadd38c3370eaaf438ba7eee9bf9d2b.1659399696.git-series.apopple@nvidia.com> References: <814dee5d3aadd38c3370eaaf438ba7eee9bf9d2b.1659399696.git-series.apopple@nvidia.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659485540; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FaVBZSPnAKfW0Q/iJj8Yt6dQmsnVRswThj98qBV0xQA=; b=jyP7hDS3T5VuT4k1Jqp5UfJvETD/e/PVjCAKC4GZlEvSH8hKGALPbpaErJKHJdFEQ8hJpH M7RhD900Iq4uiKPM1bzutnI0CPR1+Qg+u6qvO3iA/LF0gW5m6GIcK8uEY2V4lRTIBv733p 8XOPVIiAunAsTped/PWBmkND9EoL7as= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=EGn4PBf2; dmarc=none; spf=pass (imf07.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659485540; a=rsa-sha256; cv=none; b=s7iCVMsLDDKDiUwH3VXfvKFBKyE8dQiJaVeqZgrtMTMAXpSSGMcAlebJ5exLfopDD2GabG LvgN6HU1286kcvoTipMmNf45Mt7NH3mlPguU0yo5eBFe7oyRK+mHiXdz64bkXf5sX8X3sW isbwLCLBu8z36Exy5op+B9qJFgR4z2Q= X-Stat-Signature: 8htb9gn5q8rmmmkcjcbjt1mt7x5e697w X-Rspamd-Queue-Id: E6EBB4010A X-Rspamd-Server: rspam01 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=EGn4PBf2; dmarc=none; spf=pass (imf07.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1659485539-496268 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 Tue, 2 Aug 2022 10:30:12 +1000 Alistair Popple wrote: > When pinning pages with FOLL_LONGTERM check_and_migrate_movable_pages() > is called to migrate pages out of zones which should not contain any > longterm pinned pages. > > When migration succeeds all pages will have been unpinned so pinning > needs to be retried. This is indicated by returning zero. When all pages > are in the correct zone the number of pinned pages is returned. > > However migration can also fail, in which case pages are unpinned and > -ENOMEM is returned. However if the failure was due to not being unable > to isolate a page zero is returned. This leads to indefinite looping in > __gup_longterm_locked(). > > Fix this by simplifying the return codes such that zero indicates all > pages were successfully pinned in the correct zone while errors indicate > either pages were migrated and pinning should be retried or that > migration has failed and therefore the pinning operation should fail. > > This fixes the indefinite looping on page isolation failure by failing > the pin operation instead of retrying indefinitely. > Are we able to identify a Fixes: for this? Presumably something in the series "Add MEMORY_DEVICE_COHERENT for coherent device memory mapping"?