From owner-freebsd-arch@FreeBSD.ORG Mon May 5 10:31:07 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC7CC37B401; Mon, 5 May 2003 10:31:07 -0700 (PDT) Received: from beastie.mckusick.com (beastie.mckusick.com [209.31.233.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4D1943F85; Mon, 5 May 2003 10:31:06 -0700 (PDT) (envelope-from mckusick@beastie.mckusick.com) Received: from beastie.mckusick.com (localhost [127.0.0.1]) by beastie.mckusick.com (8.12.8/8.12.3) with ESMTP id h45HV5Th018656; Mon, 5 May 2003 10:31:06 -0700 (PDT) (envelope-from mckusick@beastie.mckusick.com) Message-Id: <200305051731.h45HV5Th018656@beastie.mckusick.com> To: Bruce Evans In-Reply-To: Your message of "Mon, 05 May 2003 21:30:39 +1000." <20030505205914.D8183@gamplex.bde.org> Date: Mon, 05 May 2003 10:31:05 -0700 From: Kirk McKusick cc: arch@FreeBSD.org cc: Brian Buhrow cc: Jens Schweikhardt Subject: Re: Access times on executables (kern/25777) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2003 17:31:08 -0000 As you note, NFS does not implement MNT_NOATIME. But since it does not update the atime when the read is done and since the data will already be in the cache from the earlier read of the header, there is unlikely to be an efficiency impact for NFS. Thus, it does not seem necessary to add code to explicitly exclude NFS. So, I would be inclined to just put the code in as proposed. I would rather not have a bunch of filesystem exceptions in otherwise generic code. Kirk McKusick > Date: Mon, 5 May 2003 21:30:39 +1000 (EST) > From: Bruce Evans > X-X-Sender: bde@gamplex.bde.org > To: Kirk McKusick > cc: Jens Schweikhardt , arch@FreeBSD.org, > Brian Buhrow > Subject: Re: Access times on executables (kern/25777) > In-Reply-To: <200305050617.h456HNTh017652@beastie.mckusick.com> > X-ASK-Info: Whitelist match > > On Sun, 4 May 2003, Kirk McKusick wrote: > > > Index: sys/kern_exec.c > > =================================================================== > > RCS file: /usr/ncvs/src/sys/kern/kern_exec.c,v > > retrieving revision 1.218 > > diff -c -r1.218 kern_exec.c > > *** kern_exec.c 1 Apr 2003 01:26:20 -0000 1.218 > > --- kern_exec.c 5 May 2003 06:15:21 -0000 > > *************** > > *** 598,603 **** > > --- 598,626 ---- > > exec_setregs(td, imgp->entry_addr, > > (u_long)(uintptr_t)stack_base, imgp->ps_strings); > > > > + /* > > + * At this point, it counts as an access. > > + * Ensure that atime gets updated if needed. > > + */ > > + if (!(textvp->v_mount->mnt_flag & MNT_NOATIME)) { > > Note that this check doesn't help for the most expensive case (nfs), > since nfs doesn't implement the noatime mount flag so it never sets > MNT_NOATIME. However, nfs doesn't actually implement setting of atimes > either -- if the read goes to the server, then the server sets the atime > (unless the file system on the server is mounted -noatime) and the change > is eventually seen by the clent, but most reads on the client are from > the buffer cache so they don't affect the atime on the server unless we > tell it, and we never tell it directly. This seems to be required for > reasonable efficiency. > > > + struct uio auio; > > + struct iovec aiov; > > + char ch; > > + > > + auio.uio_iov = &aiov; > > + auio.uio_iovcnt = 1; > > + aiov.iov_base = &ch; > > + aiov.iov_len = 1; > > + auio.uio_resid = 1; > > + auio.uio_offset = 0; > > + auio.uio_segflg = UIO_SYSSPACE; > > + auio.uio_rw = UIO_READ; > > + auio.uio_td = td; > > + vn_lock(textvp, LK_EXCLUSIVE | LK_RETRY, td); > > + (void) VOP_READ(textvp, &auio, 0, p->p_ucred); > > In the nfs clase, this read is very unlikely to do anything, because > we read the header earlier so this read is very likely to be from > the buffer cache. Then the previous read may have set the atime, but > this one won't. > > > + VOP_UNLOCK(textvp, 0, td); > > + } > > + > > done1: > > /* > > * Free any resources malloc'd earlier that we didn't use. > > > > I think this version would be OK if it skipped remote file systems > explicitly. > > Bruce