Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp226953imu; Tue, 27 Nov 2018 11:26:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/VmFriWkUBNefny3uvqudgBvuRIoz0VXG+Ww5Acg04WMZyN+RsamHrl0TxM8pvHDoMCLVrD X-Received: by 2002:a17:902:f01:: with SMTP id 1mr29548148ply.143.1543346814710; Tue, 27 Nov 2018 11:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543346814; cv=none; d=google.com; s=arc-20160816; b=OXmj+MNPobF6PS/bk5T6pnV4R8J//hlw+jkfgHGxjvQadpolLfB0/Ag1TP3mncB5mf ENqlJUvIINtdhVMTSa8pORF3mnES4UpKX0jMOjVb9xiJFxCUTiakr0hsc7H9sGYmijDd RvPhabGLQ5f0FyLgs+DWNWmANm9cn8DLnPA0VUrTine/zN9OGJ3Tt6HU8zfHewlPLG8/ vDagd6ijqQLRwL2KrPCouvSmVf7QdenSABHm7akFA2fCEs6iX2uu6r7H4Zx6gFcr9GVz RIAjLadkVC9H93TQRqRE+jO0nRgxEPl3nkIrk+/3BGgMb1ArecjBWhvl9YGXGXjEBgJg rRXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=u2ZnvqRjs7DCiMFtCLs0vYgGvJ59pAEB90daouxTMMs=; b=qqzGAoHU2Xn/QEHgWaijyloOFkZoMycmQDfv9ON8KBgOKiXGwxnLxXKrWiUJ6cA7UK oZoePH0cRBDeumaT0muUiIOgT6G4deCpB4xZfQfs+DOQRWhDcAR5CY+JCYzdj0qy/yAx zB3qc9PYlHbuy4Zw0N9q69X+5A0aLHspeecQ1iG9TDPwx4maJY1e4p/qQwviAtA881RQ RCXxGZbfsPk7nAKH43qEXZSIdRwzPTaQk/almwVUd/BG2uO7MT+yjgMzr7BYjveSgs3Z CEmt7gf4fF9mjwWQRhlH8tgVlFoT4iYrFbBAqdf/+JQR4Hc2wN5MD/qncZhZghehj+e6 gHEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Frb3vTyg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si4600315pln.425.2018.11.27.11.26.39; Tue, 27 Nov 2018 11:26:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Frb3vTyg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731405AbeK1DsR (ORCPT + 99 others); Tue, 27 Nov 2018 22:48:17 -0500 Received: from a9-35.smtp-out.amazonses.com ([54.240.9.35]:58582 "EHLO a9-35.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729321AbeK1DsR (ORCPT ); Tue, 27 Nov 2018 22:48:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1543337387; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=F1BHzZ5aX6F/cjHQOy9JOoTV5AqgXTRV8TX/oyCxgEM=; b=Frb3vTygO3nJKf5UEWUGLn1kdK9I85MCdX95jMYkEf9epLFu+3FdOU7yAxKIpF80 Vpy+NusMrad+1kO4Axx3jmb1aJ4NlbNzIOfb1D9N6cRzrT6Vocpdx/y3H8R+ab/iAL7 C2Y+LkARC19RJ21r2RP0eLn3NJ0xbwnISstSlQv0= Date: Tue, 27 Nov 2018 16:49:47 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Mike Rapoport cc: Matthew Wilcox , Hugh Dickins , Linus Torvalds , Andrew Morton , Baoquan He , Michal Hocko , Vlastimil Babka , Andrea Arcangeli , David Hildenbrand , Mel Gorman , David Herrmann , Tim Chen , Kan Liang , Andi Kleen , Davidlohr Bueso , Peter Zijlstra , Nick Piggin , pifang@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated In-Reply-To: <20181127105602.GC16502@rapoport-lnx> Message-ID: <010001675613a406-89de05df-ccf6-4bfa-ae3b-6f94148d514a-000000@email.amazonses.com> References: <20181126205351.GM3065@bombadil.infradead.org> <20181127105602.GC16502@rapoport-lnx> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.11.27-54.240.9.35 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Nov 2018, Mike Rapoport wrote: > > * @page: The page to wait for. > > * > > * The caller should hold a reference on @page. They expect the page to > > * become unlocked relatively soon, but do not wish to hold up migration > > * (for example) by holding the reference while waiting for the page to > > * come unlocked. After this function returns, the caller should not > > * dereference @page. > > */ > > How about: > > They expect the page to become unlocked relatively soon, but they can wait > for the page to come unlocked without holding the reference, to allow > other users of the @page (for example migration) to continue. All of this seems a bit strange and it seems unnecessary? Maybe we need a better explanation? A process has no refcount on a page struct and is waiting for it to become unlocked? Why? Should it not simply ignore that page and continue? It cannot possibly do anything with the page since it does not hold a refcount. In order to do anything with the page struct it would have to obtain a refcount and possibly lock the page. That would already wait for the page to become unlocked.