Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2539646rbb; Wed, 28 Feb 2024 05:15:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUa74+PeER6APyJXm3ebgT7lpdpKd1H+yfY0BnrT4WAYwj/EhezAm2Rr6EsYqSWlI/axYdiuRV+5eoKPCjIcca+BGrwCw1guba/dvATZQ== X-Google-Smtp-Source: AGHT+IFyNe8YKbuPFNssD/c5uRRcg4Vcx4h5L2M7r7a9Ep5VLJmVnq73P9lXD30zDYFF0r7K3z5Z X-Received: by 2002:a17:906:6d8c:b0:a3d:9ed3:dd1f with SMTP id h12-20020a1709066d8c00b00a3d9ed3dd1fmr9137529ejt.18.1709126128697; Wed, 28 Feb 2024 05:15:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709126128; cv=pass; d=google.com; s=arc-20160816; b=qlx6CuQNXeuJYNiI8Z+mFV+/B2n3QcEsDWZliusDHNRNrQtq7GK0E1LaHc84M7HwYa QGK9ktk9TZ1jkK8JRNpfffBfkIxNsx3aj4r1wSYSzXtjOSX5EHTHOIozgcAYsTXwMrfn kR3KiiNUDuahfBkW9CNMm1msM/KXNLZLTrOjxfpnuWtOQ8/W5dvCGUPSemDdQ+qEQl4e bg5weMVCFdHIf5OEA4qphbcz+/Lsh4bO6fOXvAKRpAAxonMjfpaHSLNQYMqSSEPDcwzl E3OjAhhUpQc1zouaht9ZFJoHduhsex39n0kKqBYVK5Yygct2RTBK5YP/lZkpFvHOPUvE fd+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r8vbNEwwu+aBkNpFD6Z1wwPalWetOGt3ThcRRchjvf4=; fh=ntnq9EcOzr/y7Rw56W4Rra/ewfGOqmt09ZGnBpHQOm8=; b=GAKOwXaSD5dRQ1/uTzWszYsAHKhxDv2wvpF1Euyi0/sItUCpvf2J99xtrl8yA/da/u D8Wo7VfHdUe0dvcLn2z6LvqSSFVG+u4wiw703UTTeTYnhJ/tpIJYiti5Dilt2IdG+TaK 2EtRlmBYoBtnLRKLp74RxDOoFE7owF5mUK8OvJsK3PW345menvBOFrW2VzTsxju+hNki GEjgdg/zafMr3EUcYql9krf3Ia0wNs0iG310+RPamcVn9gO7h2S4tFPqHQM1dV9Zz/M2 Q+61+T6TI0/veuMaeBdRn4RKD3853LwCNXiQUrPR9sD4FJjid/YVsVbSRBJphJoa4PcQ Zc/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=afJQMzgR; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-85079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85079-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d17-20020a170906345100b00a441a17f11dsi156298ejb.653.2024.02.28.05.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=afJQMzgR; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-85079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85079-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 741C21F279B1 for ; Wed, 28 Feb 2024 13:15:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2166714C582; Wed, 28 Feb 2024 13:15:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="afJQMzgR" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7F7314A4FB; Wed, 28 Feb 2024 13:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709126117; cv=none; b=ArZKQNJ4izRYOUNy8d4TAkpru6dZEvBJj8awxZh7MxQYlB+gP4ecmkFb2gNEmuu0DFayx1/IZ/aZn5bycWy64EwB8dWglEDTk28zIqwS+8ZnnSVj40g63LeC1rnHz2HYU0pT3SA+7i4tYmZUpI9mWGMcMHX/JC351jFTdU1IXSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709126117; c=relaxed/simple; bh=x5DAa4w3ucuQL2gRP9LGTsa9jfwHP3rQYy7xsCi5Wmw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SsZEDf+lNKtsorFJ7YJG7VEEDK6Dcbg90/tvLUmu4QIaLHhYYwN0GR08GEM2ZhGJS6zvzbm80avRr+iFpWDYfkOkEXSQn74fZQ2LRYAMd+rKfE7bxEJ0MKBqKgKwKsbxq2bkt5aChxxS7CZnr3wJxYRyQkxDJs51wBwpjiHkxUk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=afJQMzgR; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=r8vbNEwwu+aBkNpFD6Z1wwPalWetOGt3ThcRRchjvf4=; b=afJQMzgRmi9QJv2I9KZKPZSj9A yzmjVmPqSi8q04wv+igzpCR+aTfETNiVH1gWB0OdF4SmudJlSaV8va3TNQ4DX02Ep2tz3RHvsh8RU i3RgAksSmM9+IO946LtjgSLrL64ycVg21jl441XIjobz39NXESJ0mqYeIHfy8eqJLfgWM5u1MOSOp 9txR1owwuyFXWvFt6agqUx1DTB3jD10ZKyTJ6tj0qlDWxB8Ya1qP/CvKWKFliHx5Vd5I8lDrFmHg2 6PoIKzjiv57RmbIB6jfI4aJlXt/Gt2ELCjO6d8Vt5Tf/Nx4J+u3/brpRH3PDThUACvSWRBjfhehIm y+MNaNdA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfJmB-00000005GZt-24JJ; Wed, 28 Feb 2024 13:15:11 +0000 Date: Wed, 28 Feb 2024 13:15:11 +0000 From: Matthew Wilcox To: Yosry Ahmed Cc: Sean Christopherson , Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, michael.roth@amd.com, isaku.yamahata@intel.com, thomas.lendacky@amd.com Subject: Re: [PATCH 17/21] filemap: add FGP_CREAT_ONLY Message-ID: References: <20240227232100.478238-1-pbonzini@redhat.com> <20240227232100.478238-18-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Feb 27, 2024 at 06:17:34PM -0800, Yosry Ahmed wrote: > On Tue, Feb 27, 2024 at 6:15 PM Sean Christopherson wrote: > > > > On Tue, Feb 27, 2024, Paolo Bonzini wrote: > > > > This needs a changelog, and also needs to be Cc'd to someone(s) that can give it > > a thumbs up. > > +Matthew Wilcox If only there were an entry in MAINTAINERS for filemap.c ... This looks bogus to me, and if it's not bogus, it's incomplete. But it's hard to judge without a commit message that describes what it's supposed to mean. > > > > > Signed-off-by: Paolo Bonzini > > > --- > > > include/linux/pagemap.h | 2 ++ > > > mm/filemap.c | 4 ++++ > > > 2 files changed, 6 insertions(+) > > > > > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > > > index 2df35e65557d..e8ac0b32f84d 100644 > > > --- a/include/linux/pagemap.h > > > +++ b/include/linux/pagemap.h > > > @@ -586,6 +586,7 @@ pgoff_t page_cache_prev_miss(struct address_space *mapping, > > > * * %FGP_CREAT - If no folio is present then a new folio is allocated, > > > * added to the page cache and the VM's LRU list. The folio is > > > * returned locked. > > > + * * %FGP_CREAT_ONLY - Fail if a folio is not present > > > * * %FGP_FOR_MMAP - The caller wants to do its own locking dance if the > > > * folio is already in cache. If the folio was allocated, unlock it > > > * before returning so the caller can do the same dance. > > > @@ -606,6 +607,7 @@ typedef unsigned int __bitwise fgf_t; > > > #define FGP_NOWAIT ((__force fgf_t)0x00000020) > > > #define FGP_FOR_MMAP ((__force fgf_t)0x00000040) > > > #define FGP_STABLE ((__force fgf_t)0x00000080) > > > +#define FGP_CREAT_ONLY ((__force fgf_t)0x00000100) > > > #define FGF_GET_ORDER(fgf) (((__force unsigned)fgf) >> 26) /* top 6 bits */ > > > > > > #define FGP_WRITEBEGIN (FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE) > > > diff --git a/mm/filemap.c b/mm/filemap.c > > > index 750e779c23db..d5107bd0cd09 100644 > > > --- a/mm/filemap.c > > > +++ b/mm/filemap.c > > > @@ -1854,6 +1854,10 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, > > > folio = NULL; > > > if (!folio) > > > goto no_page; > > > + if (fgp_flags & FGP_CREAT_ONLY) { > > > + folio_put(folio); > > > + return ERR_PTR(-EEXIST); > > > + } > > > > > > if (fgp_flags & FGP_LOCK) { > > > if (fgp_flags & FGP_NOWAIT) { > > > -- > > > 2.39.0 > > > > > > > >