linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 9/9] swap_info: reorder its fields
Date: Thu, 15 Oct 2009 01:58:51 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0910150157310.3291@sister.anvils> (raw)
In-Reply-To: <Pine.LNX.4.64.0910150130001.2250@sister.anvils>

Reorder (and comment) the fields of swap_info_struct, to make better
use of its cachelines: it's good for swap_duplicate() in particular
if unsigned int max and swap_map are near the start.

Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---

 include/linux/swap.h |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

--- si8/include/linux/swap.h	2009-10-14 21:27:07.000000000 +0100
+++ si9/include/linux/swap.h	2009-10-14 21:27:14.000000000 +0100
@@ -167,21 +167,21 @@ struct swap_info_struct {
 	signed short	prio;		/* swap priority of this type */
 	signed char	type;		/* strange name for an index */
 	signed char	next;		/* next type on the swap list */
-	struct file *swap_file;
-	struct block_device *bdev;
-	struct swap_extent first_swap_extent;
-	struct swap_extent *curr_swap_extent;
-	unsigned char *swap_map;
-	unsigned int lowest_bit;
-	unsigned int highest_bit;
+	unsigned int	max;		/* extent of the swap_map */
+	unsigned char *swap_map;	/* vmalloc'ed array of usage counts */
+	unsigned int lowest_bit;	/* index of first free in swap_map */
+	unsigned int highest_bit;	/* index of last free in swap_map */
+	unsigned int pages;		/* total of usable pages of swap */
+	unsigned int inuse_pages;	/* number of those currently in use */
+	unsigned int cluster_next;	/* likely index for next allocation */
+	unsigned int cluster_nr;	/* countdown to next cluster search */
 	unsigned int lowest_alloc;	/* while preparing discard cluster */
 	unsigned int highest_alloc;	/* while preparing discard cluster */
-	unsigned int cluster_next;
-	unsigned int cluster_nr;
-	unsigned int pages;
-	unsigned int max;
-	unsigned int inuse_pages;
-	unsigned int old_block_size;
+	struct swap_extent *curr_swap_extent;
+	struct swap_extent first_swap_extent;
+	struct block_device *bdev;	/* swap device or bdev of swap file */
+	struct file *swap_file;		/* seldom referenced */
+	unsigned int old_block_size;	/* seldom referenced */
 };
 
 struct swap_list_t {

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2009-10-15  0:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15  0:44 [PATCH 0/9] swap_info and swap_map patches Hugh Dickins
2009-10-15  0:46 ` [PATCH 1/9] swap_info: private to swapfile.c Hugh Dickins
2009-10-15 14:57   ` Rik van Riel
2009-10-15 23:10   ` Nigel Cunningham
2009-10-16  0:28     ` Hugh Dickins
2009-10-15  0:48 ` [PATCH 2/9] swap_info: change to array of pointers Hugh Dickins
2009-10-15  2:11   ` KAMEZAWA Hiroyuki
2009-10-15 22:41     ` Hugh Dickins
2009-10-15 23:04       ` Hugh Dickins
2009-10-15 23:47         ` KAMEZAWA Hiroyuki
2009-10-15 23:46       ` KAMEZAWA Hiroyuki
2009-10-15 15:02   ` Rik van Riel
2009-10-15  0:49 ` [PATCH 3/9] swap_info: include first_swap_extent Hugh Dickins
2009-10-15  0:50 ` [PATCH 4/9] swap_info: miscellaneous minor cleanups Hugh Dickins
2009-10-15  2:19   ` KAMEZAWA Hiroyuki
2009-10-15 22:01     ` Hugh Dickins
2009-10-16  0:41   ` [PATCH 4/9 v2] " Hugh Dickins
2009-10-15  0:52 ` [PATCH 5/9] swap_info: SWAP_HAS_CACHE cleanups Hugh Dickins
2009-10-15  2:37   ` KAMEZAWA Hiroyuki
2009-10-15 22:08     ` Hugh Dickins
2009-10-15  0:53 ` [PATCH 6/9] swap_info: swap_map of chars not shorts Hugh Dickins
2009-10-15  2:44   ` KAMEZAWA Hiroyuki
2009-10-15 22:17     ` Hugh Dickins
2009-10-15 23:52       ` KAMEZAWA Hiroyuki
2009-10-15  0:56 ` [PATCH 7/9] swap_info: swap count continuations Hugh Dickins
2009-10-15  3:30   ` KAMEZAWA Hiroyuki
2009-10-15 19:45     ` Andrew Morton
2009-10-15 21:17     ` David Rientjes
2009-10-16  0:21       ` Hugh Dickins
2009-10-15 23:53     ` Hugh Dickins
2009-10-16  1:29       ` KAMEZAWA Hiroyuki
2009-10-16  2:24         ` Hugh Dickins
2009-10-16  4:06           ` KAMEZAWA Hiroyuki
2009-10-16  4:49   ` Nitin Gupta
2009-10-16  6:30   ` [PATCH] mm: call pte_unmap() against a proper pte (Re: [PATCH 7/9] swap_info: swap count continuations) Daisuke Nishimura
2009-10-16  8:01     ` KAMEZAWA Hiroyuki
2009-10-15  0:57 ` [PATCH 8/9] swap_info: note SWAP_MAP_SHMEM Hugh Dickins
2009-10-15  3:32   ` KAMEZAWA Hiroyuki
2009-10-15 22:23     ` Hugh Dickins
2009-10-16  0:04       ` KAMEZAWA Hiroyuki
2009-10-15  0:58 ` Hugh Dickins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0910150157310.3291@sister.anvils \
    --to=hugh.dickins@tiscali.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).