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 BCF43C4361A for ; Fri, 4 Dec 2020 17:06:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2DB6022B43 for ; Fri, 4 Dec 2020 17:06:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DB6022B43 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A8656B005C; Fri, 4 Dec 2020 12:06:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4319D6B005D; Fri, 4 Dec 2020 12:06:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D64A6B006E; Fri, 4 Dec 2020 12:06:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id 0F9AD6B005C for ; Fri, 4 Dec 2020 12:06:35 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C98211EE6 for ; Fri, 4 Dec 2020 17:06:34 +0000 (UTC) X-FDA: 77556228708.19.beast21_040dfaf273c6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 85C2E1ACEA2 for ; Fri, 4 Dec 2020 17:06:34 +0000 (UTC) X-HE-Tag: beast21_040dfaf273c6 X-Filterd-Recvd-Size: 5700 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Dec 2020 17:06:33 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id v143so6074814qkb.2 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=nAm26/MLYqTNLZ3EONCvQchPEAMwoyZQGLlAkMBp148p8UYUvSxKC2HsS1LPJiQCvH ZCv9Mp5EfwLYw7SK6xe+wFv9ej/rN4om+BelCLt2jRfn7wRncm+qnfs5t9nr+wnDmkMx XDnwwhLXUKZWb6mxP2DRVnNIkGS2yaWWLSNLXxT9wifi3RZwzSa59md7HStBXkgydrJx fBrrz6nytqBhlf3XNx7ESG2ATs13SNUUQKYRbVHgtmDdC+E7FemwhRQB4ePV1y0gD4Gc PHUqZJSGGlFjSUGKbHF4lfilemReU+m4O6YP9rgVu+qtOXyqsRIoRvZjg4l8xh5ptOJv nyjQ== X-Gm-Message-State: AOAM531L2H1+2IikDfIbY7qJUA77ElD2HpJ0R1GpT/d/xvAbhO1CgILh nU0SlPvsC7owWEx6fpZwyXhFEg== X-Google-Smtp-Source: ABdhPJyaQhk9DU4DugWw5rvCGLbK9uolHWpvzkXM71/KtCR4eZfYRDjn/eQYKdM+e93qFBCsxl6hjA== 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: 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 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