Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp537086pxu; Fri, 4 Dec 2020 09:09:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzi1Kunf0MCioULOkknNjOKlQRuAWfNWgT+NHH1rNHZUu2Gl6i+6cptl6CkeyHtVVa11s2d X-Received: by 2002:a50:d5c4:: with SMTP id g4mr8195724edj.334.1607101799071; Fri, 04 Dec 2020 09:09:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607101799; cv=none; d=google.com; s=arc-20160816; b=re9/cwNLfpeRIi2vcTRCm7kcURkkaRiRO3of37xzoJwV4nSzEaC1hYZEp8xg9eGJ/A rPIZPKi+HwWOWV5Ac3kXhTq/F+Sb8zkZyPu0eG4v3yTYNHfsLEf/ldNr9Uc/qkwSaDW1 SXyOEpTHaI882lwYc0ggR2r0B64c5PkfbnV8I/j/IQXDFoGQHLFudakUjjTUnWStyfNY o71ob02Byi1PIp04zuURnB+AocV3Tu/iKXPJmi0Ix5jl06ttK6vmhTbsu0jUKyhxSYF3 W10d9eoZ37MKi4k8mFnm8hYmgI9uDIgfjNj5y+qZCBlDXZpKjzpVXESTj6AheGZig1QB 4X1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yxAmVc2QQ1kqXeoN6NMvTUxhZg3wMao28Ew3b7+TbUA=; b=quuzEbQGTj6uom4sYouX/RkUHYcxsXRFoRYY85rUBP8Al/uAEDNuflwwf97y06sSIQ ArRQ9NOW1PaROtaIHj6QAFglf2ReFif/PaGceQYfJxFiskLSV93LJTSFtxLirUlqilqX AjQtA8iHYgiIdmNbiVv20ktnQ1G5fk3ZpLJqtAxrcJT7s56mOCR8XuvaIaUc7DuqQBzf WzF7UUnQx5C/fglfDelpZWmVsbCoHpxjAqlXStpbPBXjOow/4/Q7WbJjKj9JTWT8wQo4 if6OtAuS3c5Ts2mYVLwpJPLdnxvvCd680rN48TocV5coe+Z2dUcQPX9iQx5kbPSO72dj 4DRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=nLfIL7HT; 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 l4si243480ejc.485.2020.12.04.09.09.30; Fri, 04 Dec 2020 09:09:59 -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=@ziepe.ca header.s=google header.b=nLfIL7HT; 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 S1729617AbgLDRHO (ORCPT + 99 others); Fri, 4 Dec 2020 12:07:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgLDRHO (ORCPT ); Fri, 4 Dec 2020 12:07:14 -0500 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9FA9C061A4F for ; Fri, 4 Dec 2020 09:06:33 -0800 (PST) Received: by mail-qk1-x741.google.com with SMTP id x25so6072809qkj.3 for ; Fri, 04 Dec 2020 09:06:33 -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=yxAmVc2QQ1kqXeoN6NMvTUxhZg3wMao28Ew3b7+TbUA=; b=nLfIL7HT4+HDXrJwtmNfVAGkfNNK5cLKL8KuoszavQzEFPsuSpM4oGnh3lOW/moDFg +6DdD70b3VZ1CJlgMfm7jvlSkdxn8DWM4zRT8F3vMIEJ6IGWNmOQFB1F4t4lQjL6SXZ2 B4WGwfNUJ07BleEZwbikj+/SCmlU0yOUho+6rAm02hZYv6PRZYqSM3c4s5qe4T1kwj61 dlckspN2FDSiJRO0oIsrjjAQmB5+6hqQUWDD2Pv6a1mI4mkLrlJwQJ1gPfBS3l0gprMc AOFaRcTTzu+G+/S0182YIG8QpqDXcKErWjg4QRbr4IF5moIaku97EiWit8BQzdxfLYM0 pwhA== 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=yxAmVc2QQ1kqXeoN6NMvTUxhZg3wMao28Ew3b7+TbUA=; b=Nr3WBUy24EoZuRDkKyiA0Wmh6kABCOfLeW+N8o//fLu9SUct2EoVrqOTIGIRNTez63 +fTiQWEFKGiePI7gy/GGJFPVBq4KlezUIOm1IYGTbwYsl2MgZVbmepCLBWBla5+7ACQR 31oU8OSo7VROGkovZ+QuVjrDN/YVgNMLxsFUFWCuZW0mm6bo7SeKz3AxPGnYflkmCVKY 07fkEfiCk2jjvM/5PQ5sPu7anhUyMft7MLlRlKuEp69KshFMdX/omcCrPgeaExzbhMr+ UGnNq4V/zwHTDPl5eJnqa3664o+Hx10Qv7j1tZ6k33vGCUub1xTk3JuME84RhwWVqFM/ Gvow== X-Gm-Message-State: AOAM5329kIy1LCRMAfXQVzLGpg6ZVCzVhFI1bWjgCkt9wX+hQ+/iL/6W ljSPt5l08B6lcv53JL+B4WcdnA== X-Received: by 2002:a37:ac0a:: with SMTP id e10mr9905009qkm.264.1607101593185; Fri, 04 Dec 2020 09:06:33 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b14sm5022528qtx.36.2020.12.04.09.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 09:06:31 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1klEXP-005wQZ-4t; Fri, 04 Dec 2020 13:06:31 -0400 Date: Fri, 4 Dec 2020 13:06:31 -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 Subject: Re: [PATCH 6/6] mm/gup: migrate pinned pages out of movable zone Message-ID: <20201204170631.GE5487@ziepe.ca> References: <20201203010809.GQ5487@ziepe.ca> <20201203141729.GS5487@ziepe.ca> <20201203165937.GU5487@ziepe.ca> <20201203193607.GV5487@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 11:24:56AM -0500, Pavel Tatashin wrote: > On Thu, Dec 3, 2020 at 2:36 PM Jason Gunthorpe wrote: > > > > On Thu, Dec 03, 2020 at 02:15:36PM -0500, Pavel Tatashin wrote: > > > > > I studied some more, and I think this is not a race: > > > list_add_tail(&head->lru, &cma_page_list) is called only when > > > isolate_lru_page(head) succeeds. > > > isolate_lru_page(head) succeeds only when PageLRU(head) is true. > > > However, in this function we also clear LRU flag before returning > > > success. > > > This means, that if we race with another thread, the other thread > > > won't get to unprotected list_add_tail(&head->lru, &cma_page_list) > > > until head is is back on LRU list. > > > > Oh interesting, I totally didn't see how that LRU stuff is > > working. So.. this creates a ridiculously expensive spin lock? Not > > broken, but yikes :| > > Not really a spin lock, the second thread won't be able to isolate > this page, and will skip migration of this page. It looks like the intent is that it will call gup again, then goto check_again, and once again try to isolate the LRU. ie it loops. If it gets to a point where all the CMA pages fail to isolate then it simply exits with success as the cma_page_list will be empty. Is this a bug? It seems like a bug, the invariant here is to not return with a CMA page, so why do we have a path that does return with a CMA page? Jason