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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 4FD8CC433DF for ; Mon, 15 Jun 2020 17:25:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38249207DA for ; Mon, 15 Jun 2020 17:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730102AbgFORZx (ORCPT ); Mon, 15 Jun 2020 13:25:53 -0400 Received: from outbound-smtp02.blacknight.com ([81.17.249.8]:49803 "EHLO outbound-smtp02.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729807AbgFORZw (ORCPT ); Mon, 15 Jun 2020 13:25:52 -0400 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id C7668BAAB2 for ; Mon, 15 Jun 2020 18:25:50 +0100 (IST) Received: (qmail 13298 invoked from network); 15 Jun 2020 17:25:50 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.18.5]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 15 Jun 2020 17:25:47 -0000 Date: Mon, 15 Jun 2020 18:25:45 +0100 From: Mel Gorman To: Amir Goldstein Cc: Jan Kara , Alexander Viro , linux-fsdevel , linux-kernel Subject: Re: [PATCH v2] fs: Do not check if there is a fsnotify watcher on pseudo inodes Message-ID: <20200615172545.GG3183@techsingularity.net> References: <20200615121358.GF3183@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 07:26:38PM +0300, Amir Goldstein wrote: > On Mon, Jun 15, 2020 at 3:14 PM Mel Gorman wrote: > > > > Changelog since v1 > > o Updated changelog > > Slipped to commit message > It's habit, it's the layout I generally use for mm even though others prefer having it below ---. I wasn't sure of fsnotify's preferred format for tracking major differences between versions. > > > > The kernel uses internal mounts created by kern_mount() and populated > > with files with no lookup path by alloc_file_pseudo for a variety of > > reasons. An example of such a mount is for anonymous pipes. For pipes, > > every vfs_write regardless of filesystem, fsnotify_modify() is called to > > notify of any changes which incurs a small amount of overhead in fsnotify > > even when there are no watchers. It can also trigger for reads and readv > > and writev, it was simply vfs_write() that was noticed first. > > > > A patch is pending that reduces, but does not eliminte, the overhead of > > typo: eliminte > Yes. > > fsnotify but for files that cannot be looked up via a path, even that > > small overhead is unnecessary. The user API for fanotify is based on > > the pathname and a dirfd and proc entries appear to be the only visible > > representation of the files. Proc does not have the same pathname as the > > internal entry and the proc inode is not the same as the internal inode > > so even if fanotify is used on a file under /proc/XX/fd, no useful events > > are notified. > > > > Note that fanotify is not the only uapi to add marks, but this is fine by me > I suppose if Jan wants to he can make small corrections on commit. > True but I didn't think inotify was materially different as it also takes a path. Is that wrong or are there others that matter and can attach to a file that cannot be looked up via a path? > > The difference is small but in some cases it's outside the noise so > > while marginal, there is still some small benefit to ignoring fsnotify > > for files allocated via alloc_file_pseudo in some cases. > > > > Signed-off-by: Mel Gorman > > Reviewed-by: Amir Goldstein > Thanks! -- Mel Gorman SUSE Labs