The patch titled locks: don't do unnecessary allocations has been removed from the -mm tree. Its filename is locks-dont-do-unnecessary-allocations.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: locks: don't do unnecessary allocations From: Miklos Szeredi <miklos@xxxxxxxxxx> posix_lock_file() always allocates new locks in advance, even if it's easy to determine that no allocations will be needed. Optimize these cases: - FL_ACCESS flag is set - Unlocking the whole range Signed-off-by: Miklos Szeredi <miklos@xxxxxxxxxx> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/locks.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff -puN fs/locks.c~locks-dont-do-unnecessary-allocations fs/locks.c --- a/fs/locks.c~locks-dont-do-unnecessary-allocations +++ a/fs/locks.c @@ -794,7 +794,8 @@ out: static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request, struct file_lock *conflock) { struct file_lock *fl; - struct file_lock *new_fl, *new_fl2; + struct file_lock *new_fl = NULL; + struct file_lock *new_fl2 = NULL; struct file_lock *left = NULL; struct file_lock *right = NULL; struct file_lock **before; @@ -803,9 +804,15 @@ static int __posix_lock_file_conf(struct /* * We may need two file_lock structures for this operation, * so we get them in advance to avoid races. + * + * In some cases we can be sure, that no new locks will be needed */ - new_fl = locks_alloc_lock(); - new_fl2 = locks_alloc_lock(); + if (!(request->fl_flags & FL_ACCESS) && + (request->fl_type != F_UNLCK || + request->fl_start != 0 || request->fl_end != OFFSET_MAX)) { + new_fl = locks_alloc_lock(); + new_fl2 = locks_alloc_lock(); + } lock_kernel(); if (request->fl_type != F_UNLCK) { _ Patches currently in -mm which might be from miklos@xxxxxxxxxx are origin.patch fuse-use-misc_major.patch fuse-no-backgrounding-on-interrupt.patch fuse-add-control-filesystem.patch fuse-add-control-filesystem-get_sb_single-fix.patch fuse-add-control-filesystem-printk-fix.patch fuse-add-posix-file-locking-support.patch fuse-ensure-flush-reaches-userspace.patch fuse-rename-the-interrupted-flag.patch fuse-add-request-interruption.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html