]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/exit.c
[PATCH] files: files struct with RCU
[net-next-2.6.git] / kernel / exit.c
index 83beb1e93b18c77d3f2fb1d2cfb21e3f9e66c28e..6d2089a1bce74614009acfb18f1e3b95458e90cf 100644 (file)
@@ -411,15 +411,16 @@ void fastcall put_files_struct(struct files_struct *files)
                close_files(files);
                /*
                 * Free the fd and fdset arrays if we expanded them.
+                * If the fdtable was embedded, pass files for freeing
+                * at the end of the RCU grace period. Otherwise,
+                * you can free files immediately.
                 */
                fdt = files_fdtable(files);
-               if (fdt->fd != &files->fd_array[0])
-                       free_fd_array(fdt->fd, fdt->max_fds);
-               if (fdt->max_fdset > __FD_SETSIZE) {
-                       free_fdset(fdt->open_fds, fdt->max_fdset);
-                       free_fdset(fdt->close_on_exec, fdt->max_fdset);
-               }
-               kmem_cache_free(files_cachep, files);
+               if (fdt == &files->fdtab)
+                       fdt->free_files = files;
+               else
+                       kmem_cache_free(files_cachep, files);
+               free_fdtable(fdt);
        }
 }