Performance enhancement for 2.0.3x

Philip Gladstone (philip@raptor.com)
Fri, 13 Jun 1997 18:04:54 -0400


This is a multi-part message in MIME format.

--------------48A4792132A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

It turned out that in my system, the function 'get_empty_filp'
used more CPU than any other. My system is (essentially) a
heavy duty web server.

The following patch reduces the amount of CPU consumed by
a factor of 20. The overall effect on the system is small,
but worthwhile.

Philip

-- 
Philip Gladstone                           +1 617 487 7700
Raptor Systems, Waltham, MA         http://www.raptor.com/

--------------48A4792132A Content-Type: text/plain; charset=us-ascii; name="ft.pf" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ft.pf"

--- fs/file_table.c.ft Fri Jun 13 16:41:35 1997 +++ fs/file_table.c Fri Jun 13 17:58:27 1997 @@ -5,6 +5,7 @@ */ #include <linux/config.h> +#include <linux/stddef.h> #include <linux/fs.h> #include <linux/string.h> #include <linux/mm.h> @@ -129,11 +130,12 @@ do { for (f = first_file, i=0; i < nr_files; i++, f = f->f_next) if (!f->f_count) { - remove_file_free(f); - memset(f,0,sizeof(*f)); - put_last_free(f); + /* The f_next pointer is followed by the f_prev pointer */ + memset(f, 0, offsetof(struct file, f_next)); + memset(&f->f_prev + 1, 0, sizeof(*f) - sizeof(f->f_prev) - offsetof(struct file, f_prev)); f->f_count = 1; f->f_version = ++event; + first_file = f->f_next; return f; } } while (nr_files < max && grow_files());

--------------48A4792132A--