Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1660819pxj; Wed, 19 May 2021 10:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdalUIiN7Hi2cEzpulV5VQrEXSBiV77dOWkt+cnuuXCM4A4dPgCpcKd5xiPb1Ibdyo9BPO X-Received: by 2002:a17:906:6c8a:: with SMTP id s10mr361513ejr.276.1621446746650; Wed, 19 May 2021 10:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621446746; cv=none; d=google.com; s=arc-20160816; b=K0Eow76eah8hP8OjYMFqFkzBu//Gz96mB2KFjmzIY40zZlIx3j9rHJfGOV8xfeCOrv yG9x296Npg2odawhCWZZsBqi5oyupgmlQSS8qEBQ7YK8H1BrpQwj2JQmd9gGPFlQ7hfZ LalPV8LrXsb9wWaS/CA/OuqUsKB4nBIaKyBqYOycXadHcB1i8Ph3QU/p+gtjtNEuBqTr TPIjNNgbda5qYSr1Z9x31+9ZSWr4rL3H74d0XU6rggQSmL8/H5Q/gZT4dhJeaoD4csHN HM6aQJaHWnCVw+egDgiuTzM9Xr6xtXd4P1luGCiFh7oJyYyLp/XIbi+R1m0yc4lOZrAc Hb8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=CgeG2qP/Dt0DolD9hd+eO8CNy+gyRqX1j0vCg3gzxfI=; b=NwoRQQymbNCdOTognydKicyjRhJP7LzO1CPHpO9onFwuTI6BTQxd+7jOG5d/4rEX2b BMcIk+nJE6cDKPZx4Umfnb638XuvRJEIDFlICsyP4vgIc8YudFCW/R4lI6bc4R3DEh8H Fpokdrro03ZcDf/cwe7zZZtX2UaVKpFj6NvSif/64i1SW8Vj1LtFhJPm9eib99mfVZK/ jY79gDyraMASAvFS5zujennD0NMuPu7vdTFBfZZD8XBTELlD2Cf6UUwa3Y1Y7NPlLa7E DM+g+IiNUYzbYVGV8eEkKceR6ZnHeJxTgujnrfG7AulHzM/X08J+REUnO8tg1LWqFAZu ruBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 jj22si304511ejc.162.2021.05.19.10.52.02; Wed, 19 May 2021 10:52:26 -0700 (PDT) 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; 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 S1348644AbhERKrB (ORCPT + 99 others); Tue, 18 May 2021 06:47:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:56856 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348114AbhERKqt (ORCPT ); Tue, 18 May 2021 06:46:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6F7C6AFBD; Tue, 18 May 2021 10:45:24 +0000 (UTC) Subject: Re: [PATCH v10 22/33] mm/filemap: Add __folio_lock_or_retry From: Vlastimil Babka To: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jeff Layton References: <20210511214735.1836149-1-willy@infradead.org> <20210511214735.1836149-23-willy@infradead.org> <76184de4-4ab9-0f04-ab37-8637f4b22566@suse.cz> Message-ID: Date: Tue, 18 May 2021 12:45:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <76184de4-4ab9-0f04-ab37-8637f4b22566@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/18/21 12:38 PM, Vlastimil Babka wrote: >> --- a/mm/filemap.c >> +++ b/mm/filemap.c >> @@ -1623,20 +1623,18 @@ static int __folio_lock_async(struct folio *folio, struct wait_page_queue *wait) >> >> /* >> * Return values: >> - * 1 - page is locked; mmap_lock is still held. >> - * 0 - page is not locked. >> + * 1 - folio is locked; mmap_lock is still held. >> + * 0 - folio is not locked. >> * mmap_lock has been released (mmap_read_unlock(), unless flags had both >> * FAULT_FLAG_ALLOW_RETRY and FAULT_FLAG_RETRY_NOWAIT set, in >> * which case mmap_lock is still held. >> * >> * If neither ALLOW_RETRY nor KILLABLE are set, will always return 1 >> - * with the page locked and the mmap_lock unperturbed. >> + * with the folio locked and the mmap_lock unperturbed. >> */ >> -int __lock_page_or_retry(struct page *page, struct mm_struct *mm, >> +int __folio_lock_or_retry(struct folio *folio, struct mm_struct *mm, >> unsigned int flags) >> { >> - struct folio *folio = page_folio(page); >> - >> if (fault_flag_allow_retry_first(flags)) { >> /* >> * CAUTION! In this case, mmap_lock is not released > > A bit later in this branch, 'page' is accessed, but it no longer exists. And > thus as expected, it doesn't compile. Assuming it's fixed later, but > bisectability etc... Also, the switch from 'page' to &folio->page in there should probably have been done already in "[PATCH v10 20/33] mm/filemap: Add folio_lock_killable", not in this patch?