Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 22:21:12 +0100
From:      Oliver Pinter <oliver.pinter@hardenedbsd.org>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r293197 - head/sys/kern
Message-ID:  <CAPQ4ffvZJKTwX1CSnLgD5v-D0A0feks-uj8G_p7SOAnSeC8grQ@mail.gmail.com>
In-Reply-To: <201601051448.u05Eme83057405@repo.freebsd.org>
References:  <201601051448.u05Eme83057405@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/5/16, Konstantin Belousov <kib@freebsd.org> wrote:
> Author: kib
> Date: Tue Jan  5 14:48:40 2016
> New Revision: 293197
> URL: https://svnweb.freebsd.org/changeset/base/293197
>
> Log:
>   Two fixes for excessive iterations after r292326.
>
>   Advance the logical block number to the lblkno of the found block plus
>   one, instead of incrementing the block number which was used for
>   lookup.  This change skips sparcely populated buffer ranges, similar
>   to r292325, instead of doing useless lookups.
>
>   Do not restart the bnoreuselist() from the start of the range if
>   buffer lock cannot be obtained without sleep.  Only retry lookup and
>   lock for the same queue and same logical block number.
>
>   Reported by:	benno
>   Tested by:	pho
>   Sponsored by:	The FreeBSD Foundation
>   MFC after:	3 days

Hi Konstantin!

How do you plan to MFC this commit? Only by itself or together with r293059?


>
> Modified:
>   head/sys/kern/vfs_default.c
>   head/sys/kern/vfs_subr.c
>
> Modified: head/sys/kern/vfs_default.c
> ==============================================================================
> --- head/sys/kern/vfs_default.c	Tue Jan  5 14:21:02 2016	(r293196)
> +++ head/sys/kern/vfs_default.c	Tue Jan  5 14:48:40 2016	(r293197)
> @@ -1080,15 +1080,9 @@ vop_stdadvise(struct vop_advise_args *ap
>  		bsize = vp->v_bufobj.bo_bsize;
>  		startn = ap->a_start / bsize;
>  		endn = ap->a_end / bsize;
> -		for (;;) {
> -			error = bnoreuselist(&bo->bo_clean, bo, startn, endn);
> -			if (error == EAGAIN)
> -				continue;
> +		error = bnoreuselist(&bo->bo_clean, bo, startn, endn);
> +		if (error == 0)
>  			error = bnoreuselist(&bo->bo_dirty, bo, startn, endn);
> -			if (error == EAGAIN)
> -				continue;
> -			break;
> -		}
>  		BO_RUNLOCK(bo);
>  		VOP_UNLOCK(vp, 0);
>  		break;
>
> Modified: head/sys/kern/vfs_subr.c
> ==============================================================================
> --- head/sys/kern/vfs_subr.c	Tue Jan  5 14:21:02 2016	(r293196)
> +++ head/sys/kern/vfs_subr.c	Tue Jan  5 14:48:40 2016	(r293197)
> @@ -1669,7 +1669,8 @@ bnoreuselist(struct bufv *bufv, struct b
>
>  	ASSERT_BO_LOCKED(bo);
>
> -	for (lblkno = startn;; lblkno++) {
> +	for (lblkno = startn;;) {
> +again:
>  		bp = BUF_PCTRIE_LOOKUP_GE(&bufv->bv_root, lblkno);
>  		if (bp == NULL || bp->b_lblkno >= endn)
>  			break;
> @@ -1677,11 +1678,14 @@ bnoreuselist(struct bufv *bufv, struct b
>  		    LK_INTERLOCK, BO_LOCKPTR(bo), "brlsfl", 0, 0);
>  		if (error != 0) {
>  			BO_RLOCK(bo);
> -			return (error != ENOLCK ? error : EAGAIN);
> +			if (error == ENOLCK)
> +				goto again;
> +			return (error);
>  		}
>  		KASSERT(bp->b_bufobj == bo,
>  		    ("bp %p wrong b_bufobj %p should be %p",
>  		    bp, bp->b_bufobj, bo));
> +		lblkno = bp->b_lblkno + 1;
>  		if ((bp->b_flags & B_MANAGED) == 0)
>  			bremfree(bp);
>  		bp->b_flags |= B_RELBUF;
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPQ4ffvZJKTwX1CSnLgD5v-D0A0feks-uj8G_p7SOAnSeC8grQ>