linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 00/24] Refactor sys_swapon
@ 2011-03-05 16:42 Cesar Eduardo Barros
  2011-03-05 16:42 ` [PATCHv2 01/24] sys_swapon: use vzalloc instead of vmalloc/memset Cesar Eduardo Barros
                   ` (23 more replies)
  0 siblings, 24 replies; 69+ messages in thread
From: Cesar Eduardo Barros @ 2011-03-05 16:42 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Hugh Dickins, KAMEZAWA Hiroyuki, Minchan Kim,
	Jens Axboe, linux-kernel, Eric B Munson, Cesar Eduardo Barros

[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@mgebm.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 69+ messages in thread
* Re: [PATCH 00/24] Refactor sys_swapon
@ 2011-03-01 23:23 Cesar Eduardo Barros
  2011-03-01 23:28 ` [PATCHv2 " Cesar Eduardo Barros
  0 siblings, 1 reply; 69+ messages in thread
From: Cesar Eduardo Barros @ 2011-03-01 23:23 UTC (permalink / raw)
  To: Eric B Munson; +Cc: linux-mm

Em 01-03-2011 15:20, Eric B Munson escreveu:
> On Sat, 12 Feb 2011, Cesar Eduardo Barros wrote:
>
>> This patch series refactors the sys_swapon function.
>
> I have been working on reviewing/testing this set and I cannot get it
> to apply to Linus' tree, what is this set based on?

According to the git tree from which I generated these patches, it was 
based on v2.6.38-rc4.

Commit 8074b26 (mm: fix refcounting in swapon) is what probably is 
causing you conflicts. I was planning to rebase and repost this patch 
series this weekend because of it.

I just did a quick rebase to Linus' current tree, and will post the 
whole set as a reply to this email. I have not even compile tested it, 
but the change is so small that, unless I made a typo when fixing the 
merge conflicts, it should work the same. The patches affected are 08 
(context only), 10, and 13.

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 69+ messages in thread

end of thread, other threads:[~2011-03-07 10:29 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-05 16:42 [PATCHv2 00/24] Refactor sys_swapon Cesar Eduardo Barros
2011-03-05 16:42 ` [PATCHv2 01/24] sys_swapon: use vzalloc instead of vmalloc/memset Cesar Eduardo Barros
2011-03-05 17:04   ` Pekka Enberg
2011-03-05 19:07   ` Jesper Juhl
2011-03-07  9:13   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 02/24] sys_swapon: remove changelog from function comment Cesar Eduardo Barros
2011-03-05 17:05   ` Pekka Enberg
2011-03-05 19:11   ` Jesper Juhl
2011-03-07  9:17   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 03/24] sys_swapon: do not depend on "type" after allocation Cesar Eduardo Barros
2011-03-05 17:07   ` Pekka Enberg
2011-03-07  9:24   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 04/24] sys_swapon: separate swap_info allocation Cesar Eduardo Barros
2011-03-05 17:07   ` Pekka Enberg
2011-03-07  9:28   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 05/24] sys_swapon: simplify error return from " Cesar Eduardo Barros
2011-03-05 17:08   ` Pekka Enberg
2011-03-07  9:29   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 06/24] sys_swapon: simplify error flow in alloc_swap_info Cesar Eduardo Barros
2011-03-05 17:10   ` Pekka Enberg
2011-03-07  9:31   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 07/24] sys_swapon: remove initial value of name variable Cesar Eduardo Barros
2011-03-05 17:11   ` Pekka Enberg
2011-03-07  9:33   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 08/24] sys_swapon: move setting of error nearer use Cesar Eduardo Barros
2011-03-05 19:15   ` Jesper Juhl
2011-03-07  9:22   ` Pekka Enberg
2011-03-07  9:35   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 09/24] sys_swapon: remove did_down variable Cesar Eduardo Barros
2011-03-07  9:43   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 10/24] sys_swapon: remove bdev variable Cesar Eduardo Barros
2011-03-07  9:45   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 11/24] sys_swapon: do only cleanup in the cleanup blocks Cesar Eduardo Barros
2011-03-07  9:48   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 12/24] sys_swapon: use a single error label Cesar Eduardo Barros
2011-03-07  9:52   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 13/24] sys_swapon: separate bdev claim and inode lock Cesar Eduardo Barros
2011-03-07  9:53   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 14/24] sys_swapon: simplify error flow in claim_swapfile Cesar Eduardo Barros
2011-03-07  9:55   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 15/24] sys_swapon: move setting of swapfilepages near use Cesar Eduardo Barros
2011-03-05 19:44   ` Jesper Juhl
2011-03-07  9:23   ` Pekka Enberg
2011-03-07  9:56   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 16/24] sys_swapon: separate parsing of swapfile header Cesar Eduardo Barros
2011-03-07  9:57   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 17/24] sys_swapon: simplify error flow in read_swap_header Cesar Eduardo Barros
2011-03-07  9:58   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 18/24] sys_swapon: call swap_cgroup_swapon earlier Cesar Eduardo Barros
2011-03-05 17:25   ` Pekka Enberg
2011-03-07  9:59   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 19/24] sys_swapon: separate parsing of bad blocks and extents Cesar Eduardo Barros
2011-03-05 17:25   ` Pekka Enberg
2011-03-07 10:00   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 20/24] sys_swapon: simplify error flow in setup_swap_map_and_extents Cesar Eduardo Barros
2011-03-05 17:22   ` Pekka Enberg
2011-03-07 10:03   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 21/24] sys_swapon: remove nr_good_pages variable Cesar Eduardo Barros
2011-03-05 17:18   ` Pekka Enberg
2011-03-07 10:04   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 22/24] sys_swapon: move printk outside lock Cesar Eduardo Barros
2011-03-07 10:05   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 23/24] sys_swapoff: change order to match sys_swapon Cesar Eduardo Barros
2011-03-05 17:21   ` Pekka Enberg
2011-03-07 10:06   ` KAMEZAWA Hiroyuki
2011-03-05 16:42 ` [PATCHv2 24/24] sys_swapon: separate final enabling of the swapfile Cesar Eduardo Barros
2011-03-05 17:20   ` Pekka Enberg
2011-03-07 10:23   ` KAMEZAWA Hiroyuki
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01 23:23 [PATCH 00/24] Refactor sys_swapon Cesar Eduardo Barros
2011-03-01 23:28 ` [PATCHv2 " Cesar Eduardo Barros
2011-03-01 23:28   ` [PATCHv2 16/24] sys_swapon: separate parsing of swapfile header Cesar Eduardo Barros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).