[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1299343345-3984-1-git-send-email-cesarb@cesarb.net>
Date: Sat, 5 Mar 2011 13:42:01 -0300
From: Cesar Eduardo Barros <cesarb@...arb.net>
To: linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Minchan Kim <minchan.kim@...il.com>,
Jens Axboe <jaxboe@...ionio.com>, linux-kernel@...r.kernel.org,
Eric B Munson <emunson@...bm.net>,
Cesar Eduardo Barros <cesarb@...arb.net>
Subject: [PATCHv2 00/24] Refactor sys_swapon
[Resending with a Cc: list generated by get_maintainer.pl as suggested
by Eric B Munson, and with his Tested-by and Acked-by added to each
patch.]
This patch series refactors the sys_swapon function.
sys_swapon is currently a very large function, with 313 lines (more than
12 25-line screens), which can make it a bit hard to read. This patch
series reduces this size by half, by extracting large chunks of related
code to new helper functions.
One of these chunks of code was nearly identical to the part of
sys_swapoff which is used in case of a failure return from
try_to_unuse(), so this patch series also makes both share the same
code.
As a side effect of all this refactoring, the compiled code gets a bit
smaller (from v1 of this patch series):
text data bss dec hex filename
14012 944 276 15232 3b80 mm/swapfile.o.before
13941 944 276 15161 3b39 mm/swapfile.o.after
The v1 of this patch series was lightly tested on a x86_64 VM.
[Eric B Munson <emunson@...bm.net> adds for the v2 of this patch series:
> I have tested this set on x86_64 by manually adding/removing swap
> files and partitions. Also I used the hugeadm program (fomr
> libhugetlbfs) to add temporary swap files on disk and using ram disks.
> All of this worked well.
]
Changes from v1:
Rebased from v2.6.38-rc4 to v2.6.38-rc7.
Cesar Eduardo Barros (24):
sys_swapon: use vzalloc instead of vmalloc/memset
sys_swapon: remove changelog from function comment
sys_swapon: do not depend on "type" after allocation
sys_swapon: separate swap_info allocation
sys_swapon: simplify error return from swap_info allocation
sys_swapon: simplify error flow in alloc_swap_info
sys_swapon: remove initial value of name variable
sys_swapon: move setting of error nearer use
sys_swapon: remove did_down variable
sys_swapon: remove bdev variable
sys_swapon: do only cleanup in the cleanup blocks
sys_swapon: use a single error label
sys_swapon: separate bdev claim and inode lock
sys_swapon: simplify error flow in claim_swapfile
sys_swapon: move setting of swapfilepages near use
sys_swapon: separate parsing of swapfile header
sys_swapon: simplify error flow in read_swap_header
sys_swapon: call swap_cgroup_swapon earlier
sys_swapon: separate parsing of bad blocks and extents
sys_swapon: simplify error flow in setup_swap_map_and_extents
sys_swapon: remove nr_good_pages variable
sys_swapon: move printk outside lock
sys_swapoff: change order to match sys_swapon
sys_swapon: separate final enabling of the swapfile
mm/swapfile.c | 360 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 197 insertions(+), 163 deletions(-)
--
1.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists