From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: + sys_swapon-call-swap_cgroup_swapon-earlier.patch added to -mm tree Date: Mon, 07 Mar 2011 14:10:22 -0800 Message-ID: <201103072210.p27MAMML030031@imap1.linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:36879 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756616Ab1CGWLS (ORCPT ); Mon, 7 Mar 2011 17:11:18 -0500 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org Cc: cesarb@cesarb.net, emunson@mgebm.net, hughd@google.com, kamezawa.hiroyu@jp.fujitsu.com, penberg@kernel.org The patch titled sys_swapon: call swap_cgroup_swapon() earlier has been added to the -mm tree. Its filename is sys_swapon-call-swap_cgroup_swapon-earlier.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: sys_swapon: call swap_cgroup_swapon() earlier From: Cesar Eduardo Barros The call to swap_cgroup_swapon is in the middle of loading the swap map and extents. As it only does memory allocation and does not depend on the swapfile layout (map/extents), it can be called earlier (or later). Move it to just after the allocation of swap_map, since it is conceptually similar (allocates a map). Signed-off-by: Cesar Eduardo Barros Tested-by: Eric B Munson Acked-by: Eric B Munson Reviewed-by: Pekka Enberg Reviewed-by: KAMEZAWA Hiroyuki Cc: Hugh Dickins Signed-off-by: Andrew Morton --- mm/swapfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff -puN mm/swapfile.c~sys_swapon-call-swap_cgroup_swapon-earlier mm/swapfile.c --- a/mm/swapfile.c~sys_swapon-call-swap_cgroup_swapon-earlier +++ a/mm/swapfile.c @@ -2074,6 +2074,10 @@ SYSCALL_DEFINE2(swapon, const char __use goto bad_swap; } + error = swap_cgroup_swapon(p->type, maxpages); + if (error) + goto bad_swap; + nr_good_pages = maxpages - 1; /* omit header page */ for (i = 0; i < swap_header->info.nr_badpages; i++) { @@ -2088,10 +2092,6 @@ SYSCALL_DEFINE2(swapon, const char __use } } - error = swap_cgroup_swapon(p->type, maxpages); - if (error) - goto bad_swap; - if (nr_good_pages) { swap_map[0] = SWAP_MAP_BAD; p->max = maxpages; _ Patches currently in -mm which might be from cesarb@cesarb.net are sys_swapon-use-vzalloc-instead-of-vmalloc-memset.patch sys_swapon-remove-changelog-from-function-comment.patch sys_swapon-do-not-depend-on-type-after-allocation.patch sys_swapon-separate-swap_info-allocation.patch sys_swapon-simplify-error-return-from-swap_info-allocation.patch sys_swapon-simplify-error-flow-in-alloc_swap_info.patch sys_swapon-remove-initial-value-of-name-variable.patch sys_swapon-move-setting-of-error-nearer-use.patch sys_swapon-remove-did_down-variable.patch sys_swapon-remove-bdev-variable.patch sys_swapon-do-only-cleanup-in-the-cleanup-blocks.patch sys_swapon-use-a-single-error-label.patch sys_swapon-separate-bdev-claim-and-inode-lock.patch sys_swapon-simplify-error-flow-in-claim_swapfile.patch sys_swapon-move-setting-of-swapfilepages-near-use.patch sys_swapon-separate-parsing-of-swapfile-header.patch sys_swapon-simplify-error-flow-in-read_swap_header.patch sys_swapon-call-swap_cgroup_swapon-earlier.patch sys_swapon-separate-parsing-of-bad-blocks-and-extents.patch sys_swapon-simplify-error-flow-in-setup_swap_map_and_extents.patch sys_swapon-remove-nr_good_pages-variable.patch sys_swapon-move-printk-outside-lock.patch sys_swapoff-change-order-to-match-sys_swapon.patch sys_swapon-separate-final-enabling-of-the-swapfile.patch