vfs: use kmalloc() to allocate fdmem if possible
vfs: use kmalloc() to allocate fdmem if possible

Use kmalloc() to allocate fdmem if possible.

vmalloc() is used as a fallback solution for fdmem allocation.  A new
helper function __free_fdtable() is introduced to reduce the lines of
code.

A potential bug, vfree() a memory allocated by kmalloc(), is fixed.

[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: use __GFP_NOWARN, uninline alloc_fdmem() and free_fdmem()]
Signed-off-by: Changli Gao <e0c990ad75746f704921cca52caa8fdda39c56b7@gmail.com>
Cc: Alexander Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>
Cc: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Cc: "Paul E. McKenney" <1e0ce936bb9b355d257bf5790d2513c3f28be22b@linux.vnet.ibm.com>
Cc: Alexey Dobriyan <b99bff5923d24d2fb8e844db9dac7cd59203da1d@gmail.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Avi Kivity <8f920f22884d6fea9df883843c4a8095a2e5ac6f@redhat.com>
Cc: Tetsuo Handa <3d00b54ad717112934d0b63b7ac2975b44022a61@i-love.sakura.ne.jp>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas