Skip to contentSkip to conversation

2.4.22pre6aa1

DISCUSSION Sergey S. Kostyliov 3 participants 9 messages Jul 23, 2003 – Aug 16, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Andrea,

This is during swapoff -a, on a heavily loaded box:

ksymoops 2.4.9 on i686 2.4.22-pre6aa1. Options used
-V (default)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.4.22-pre6aa1/ (default) -m /usr/src/linux/System.map (default)

Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options.

Error (regular_file): read_system_map stat /usr/src/linux/System.map failed
ksymoops: No such file or directory
kernel BUG at shmem.c:490!

invalid operand: 0000 2.4.22-pre6aa1 #1 SMP Thu Jul 17 20:24:29 MSD 2003
CPU:    0
EIP:    0010:[<801424cb>]    Not tainted

Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010202
eax: 00000508 ebx: 8d846a00 ecx: c7919800 edx: c79198fc
esi: c79198fc edi: 8d846b40 ebp: 97b999a0 esp: af853e34
ds: 0018 es: 0018 ss: 0018
Process oracle (pid: 23274, stackpage=af853000)

Stack: 8d846a00 8d846a00 80142460 c7919800 80161abf 8d846a00 00000000 00000000
       97b999a0 8d846a00 8d846a00 8015e98e 8d846a00 97b999a0 97b999a0 97b999b8
       8015ea5a 97b999a0 803349e0 8d141860 c78f6fa0 80148acb 97b999a0 9eb9f774
Call Trace:    [<80142460>] [<80161abf>] [<8015e98e>] [<8015ea5a>] 

[<80148acb>]
[<80132695>] [<8011c35a>] [<80121c66>] [<80128069>] [<80127f13>]
[<80128115>]
[<801073a8>] [<801236c4>] [<80123562>] [<80127546>] [<80115b50>]
[<80117b80>]
[<80107614>]

Code: 0f 0b ea 01 24 c1 27 80 eb cd 0f 0b e9 01 24 c1 27 80 eb bc
Quoted 1 line
Quoted 1 line

EIP; 801424cb <alloc_pages_node+75b/2c70> <=====

Trace; 80142460 <alloc_pages_node+6f0/2c70>
Trace; 80161abf <iput+14f/2b0>
Trace; 8015e98e <lock_may_write+21e/260>
Trace; 8015ea5a <dput+8a/150>
Trace; 80148acb <fput+db/110>
Trace; 80132695 <do_brk+3d5/700>
Trace; 8011c35a <remove_wait_queue+4fa/d10>
Trace; 80121c66 <exit_mm+4f6/770>
Trace; 80128069 <unblock_all_signals+109/150>
Trace; 80127f13 <flush_signal_handlers+103/110>
Trace; 80128115 <dequeue_signal+65/4f0>
Trace; 801073a8 <__read_lock_failed+11a8/17c0>
Trace; 801236c4 <tasklet_kill+f4/120>
Trace; 80123562 <__tasklet_hi_schedule+162/1a0>
Trace; 80127546 <del_timer_sync+a16/ca0>
Trace; 80115b50 <smp_call_function+ce0/19f0>
Trace; 80117b80 <__verify_write+230/ab0>
Trace; 80107614 <__read_lock_failed+1414/17c0>

Code; 801424cb <alloc_pages_node+75b/2c70>
00000000 <_EIP>:
Code; 801424cb <alloc_pages_node+75b/2c70> <=====
0: 0f 0b ud2a <=====
Code; 801424cd <alloc_pages_node+75d/2c70>
2: ea 01 24 c1 27 80 eb ljmp $0xeb80,$0x27c12401
Code; 801424d4 <alloc_pages_node+764/2c70>
9: cd 0f int $0xf
Code; 801424d6 <alloc_pages_node+766/2c70>
b: 0b e9 or %ecx,%ebp
Code; 801424d8 <alloc_pages_node+768/2c70>
d: 01 24 c1 add %esp,(%ecx,%eax,8)
Code; 801424db <alloc_pages_node+76b/2c70>
10: 27 daa
Code; 801424dc <alloc_pages_node+76c/2c70>
11: 80 eb bc sub $0xbc,%bl

1 warning and 1 error issued. Results may not be reliable.

Signature · 3 lines
                   Best regards,
                   Sergey S. Kostyliov <[email protected]>
                   Public PGP key: http://sysadminday.org.ru/rathamahata.asc
#1 lore raw
Quoted 18 lines · Sergey S. Kostyliov

Hello Andrea,

This is during swapoff -a, on a heavily loaded box:

ksymoops 2.4.9 on i686 2.4.22-pre6aa1. Options used
-V (default)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.4.22-pre6aa1/ (default) -m /usr/src/linux/System.map (default)

Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options.

Quoted 3 lines

Error (regular_file): read_system_map stat /usr/src/linux/System.map failed
ksymoops: No such file or directory
kernel BUG at shmem.c:490!

hmm, 2.4.22pre6aa1 was the first 2.4 largepages port to the >=22pre shmfs backport from 2.5. It could be a bug in 2.5, or a bug present only in the backport of the 2.5 code to 22pre, or even a bug only present in -aa due the largepage patch ported on top of the backport included in 22pre. I'll have a closer look at it tomorrow. The place where it crashed is:

	BUG_ON(inode->i_blocks);

it might be only a minor accounting issue. It needs some auditing.

I'm afraid you're the first one testing the shmfs backport in 22pre + the largepage support patch in my tree with a big app doing swapoff at the same time.

Are you using bigpages btw?

thank you very much for the feedback,

Andrea

PS. shall this give us relevant problems in the debugging/auditing, I'll just give you a patch to backout the backport and go back to the shmfs code in 2.4.21rc8aa1 that is running rock solid in production with largepages (I doubt you need the loop device on top of shmfs anyways). I prefer not to spend much time on new 2.4 features.

#2 lore raw

Hello Andrea,

Quoted 2 lines · you
Quoted 1 line · Sergey S. Kostyliov

Hello Andrea,

<cut>

Quoted 10 lines

hmm, 2.4.22pre6aa1 was the first 2.4 largepages port to the >=22pre shmfs backport from 2.5. It could be a bug in 2.5, or a bug present only in the backport of the 2.5 code to 22pre, or even a bug only present in -aa due the largepage patch ported on top of the backport included in 22pre. I'll have a closer look at it tomorrow. The place where it crashed is:

	BUG_ON(inode->i_blocks);

it might be only a minor accounting issue. It needs some auditing.

Thanks for you recponce!
Yes, it seems possible. At least it continue to run just fine after oops for 2.4.22pre6aa1.
Btw I've managed to get a hard lockup with 2.4.22pre7aa1 in the same scenario. It just stops responding to even Alt+SysRq+* from keyboard.

Quoted 6 lines

I'm afraid you're the first one testing the shmfs backport in 22pre + the largepage support patch in my tree with a big app doing swapoff at the same time.

Are you using bigpages btw?

No, I'm not using bigpages.

Quoted 10 lines

thank you very much for the feedback,

Andrea

PS. shall this give us relevant problems in the debugging/auditing, I'll just give you a patch to backout the backport and go back to the shmfs code in 2.4.21rc8aa1 that is running rock solid in production with largepages (I doubt you need the loop device on top of shmfs anyways). I prefer not to spend much time on new 2.4 features.

I doubt it depends on bigpages because they
are not used in my setup. But I can live with that. Rule: do not run swapoff -a under load doesn't sound as impossible in my case (if this is the only way to trigger this problem).

Signature · 3 lines
                   Best regards,
                   Sergey S. Kostyliov <[email protected]>
                   Public PGP key: http://sysadminday.org.ru/rathamahata.asc
#3 lore raw

Hi Sergey,

Quoted 4 lines · Sergey S. Kostyliov

I doubt it depends on bigpages because they
are not used in my setup. But I can live with that. Rule: do not run swapoff -a under load doesn't sound as impossible in my case (if this is the only way to trigger this problem).

can you reproduce it with 2.4.21rc8aa1? If not, then likely it's a 2.5/2.6 bug that went in 2.4 during the backport. I spoke with Hugh an hour ago about this, he will soon look into this too.

Andrea

#4 lore raw

Hello Andrea,

Quoted 11 lines · Andrea Arcangeli

Hi Sergey,

Quoted 4 lines · Sergey S. Kostyliov

I doubt it depends on bigpages because they
are not used in my setup. But I can live with that. Rule: do not run swapoff -a under load doesn't sound as impossible in my case (if this is the only way to trigger this problem).

can you reproduce it with 2.4.21rc8aa1? If not, then likely it's a 2.5/2.6 bug that went in 2.4 during the backport. I spoke with Hugh an hour ago about this, he will soon look into this too.

Sorry for late responce. I wasn't able to reproduce neither oops nor lockup with 2.4.21rc8aa1.

Quoted 2 lines

Andrea

Signature · 3 lines
                   Best regards,
                   Sergey S. Kostyliov <[email protected]>
                   Public PGP key: http://sysadminday.org.ru/rathamahata.asc
#5 lore raw
Quoted 11 lines · Sergey S. Kostyliov

Hello Andrea,

Quoted 8 lines · Andrea Arcangeli

Hi Sergey,

Quoted 4 lines · Sergey S. Kostyliov

I doubt it depends on bigpages because they
are not used in my setup. But I can live with that. Rule: do not run swapoff -a under load doesn't sound as impossible in my case (if this is the only way to trigger this problem).

Quoted 6 lines
Quoted 3 lines

can you reproduce it with 2.4.21rc8aa1? If not, then likely it's a 2.5/2.6 bug that went in 2.4 during the backport. I spoke with Hugh an hour ago about this, he will soon look into this too.

Sorry for late responce. I wasn't able to reproduce neither oops nor lockup with 2.4.21rc8aa1.

ok good. I'm betting it's the shm backport that destabilized something. I had no time to look further into it during vacations ;), but the first suspect thing I mentioned to Hugh during OLS was this:

static void shmem_removepage(struct page *page)

{
	if (!PageLaunder(page))
		shmem_free_blocks(page->mapping->host, 1);
}

It's not exactly obvious how the accounting should change in function of the Launder bit. I mean, a writepage can happen even w/o the launder bitflag set (if it's not invoked by the vm) and I don't see how a msync or a vm pressure writepage trigger should be different in terms of accounting of the blocks in an inode.

Overall I need a bit more of time on Monday to digest the whole backport to be sure of what's going on and if the above is right after all.

Andrea

#6 lore raw

Hi Andrea,

Welcome back. Sergey and I have been in contact over this while you were away, I kept it private so as not to inflate your mailbox further.

Brief summary (subject to confirmation by Sergey's testing) would be:
don't worry about it, it's not an -aa problem, it's a long-standing and rare bug, in fact much less likely to occur in current 2.6 and 2.4.22-rc than in 2.4.21 and earlier: seems Sergey's just been doing good testing. So I've not bothered Marcelo with fixing it for 2.4.22, will submit fix to 2.6.0-test and 2.4.23-pre later on.

You'll immediately counter what I've said there, by pointing out that BUG_ON(inode->i_blocks) couldn't have triggered in 2.4.21 and earlier, since I only added it in 2.4.22-pre. True, but instead it would have gone on to hit clear_inode's "if (inode->i_data.nrpages) BUG();" (assuming I've identified the issue correctly).

Quoted 7 lines · Andrea Arcangeli
Quoted 6 lines · Sergey S. Kostyliov
Quoted 5 lines · Andrea Arcangeli
Quoted 4 lines · Sergey S. Kostyliov

I doubt it depends on bigpages because they
are not used in my setup. But I can live with that. Rule: do not run swapoff -a under load doesn't sound as impossible in my case (if this is the only way to trigger this problem).

I believe the issue is that shmem_unuse_inode can swizzle a page from swap cache back into page cache after deletion's or truncation's truncate_inode_pages has cleaned out the page cache for that inode.

Not a great big deal in the truncation case (though it could depart from spec: I can imagine fsx detecting inconsistency, seen before 2.4.22-pre, but not since), but dangerous in the deletion case - if there were neither i_blocks nor nrpages BUG, then you'd end up with a page in the cache with page->mapping pointing into freed inode.

There used to be nothing to prevent this (the info->sem I eliminated was of no use in the swapoff case), but in 2.5 and 2.4.22-pre I added those I_FREEING and i_size checks to shmem_unuse_inode to prevent it.

Or so I thought. But faced with explaining Sergey's BUG_ON, I eventually realized it's not good enough (when SMP) just to check before adding into page cache, it needs to be checked after.

Or, as in the patch Sergey is currently testing below, shmem_truncate must be prepared to truncate_inode_pages again. That's the approach I originally implemented in 2.5, but I grew disgusted with it every time I thought of partial truncation trundling twice through truncate_inode_pages (it can easily be avoided when nrpages == 0, but that's unlikely in partial truncation).

So VM_PAGEIN flag stuff to restrict it to when it might be necessary; extended to cover other races when reading the page at the same time as truncating (though I think generic_file_read has a window of this kind that we've never worried about). I expect to split the patch into several before sending Marcelo and Andrew.

There may be another piece needed, for even rarer race: what if the truncated page arrives at shmem_writepage after shmem_truncate has cleaned the swap pages, before it recalls truncate_inode_pages? But I'll return to this later, I'm attending to other stuff right now, this is all exceedingly rare (unless Sergey shows otherwise).

If Andrew happens to be reading this, yes, these subtle races and oft-revisited solutions do shed further doubt on the whole business of tmpfs swapcache swizzling: perhaps 2.7 can find a safer way.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

can you reproduce it with 2.4.21rc8aa1? If not, then likely it's a 2.5/2.6 bug that went in 2.4 during the backport. I spoke with Hugh an hour ago about this, he will soon look into this too.

Sorry for late responce. I wasn't able to reproduce neither oops nor lockup with 2.4.21rc8aa1.

It (or rather, clear_inode's nrpages BUG) should be much easier to hit with 2.4.21rc8aa1. I wonder whether Sergey was just (un)lucky to hit it in his 2.4.22pre6aa1 testing: he's not mentioned whether or not he can reproduce it at will. I've not been able to reproduce it at all.

There might be some kind of timing difference, which somehow makes it easier to hit the narrower window in 2.4.22pre6aa1, but I don't see what that is.

Quoted 10 lines

ok good. I'm betting it's the shm backport that destabilized something. I had no time to look further into it during vacations ;), but the first suspect thing I mentioned to Hugh during OLS was this:

static void shmem_removepage(struct page *page)

{
	if (!PageLaunder(page))
		shmem_free_blocks(page->mapping->host, 1);
}
Quoted 5 lines

It's not exactly obvious how the accounting should change in function of the Launder bit. I mean, a writepage can happen even w/o the launder bitflag set (if it's not invoked by the vm) and I don't see how a msync or a vm pressure writepage trigger should be different in terms of accounting of the blocks in an inode.

I thought we'd settled this one then. I understand you're suspicious of using a PageLaunder test in that way, but it has worked correctly in the -ac tree for a year or so. The point is, shmem_removepage gets called whenever shmem page removed from cache, so it gets called when shmem_writepage moves page from page to swap cache: but in that case the page must still be counted as occupying filesystem space, we must not adjust shmem_free_blocks. PageLaunder, set only during writepage, identifies that case. I guess I should add a comment there.

Quoted 2 lines

Overall I need a bit more of time on Monday to digest the whole backport to be sure of what's going on and if the above is right after all.

If you have time to do so, that would be great: but I don't think it need be your priority. Certainly nobody else has reported a problem.

Hugh

#7 lore raw
Quoted 8 lines · Hugh Dickins

Or, as in the patch Sergey is currently testing below, shmem_truncate must be prepared to truncate_inode_pages again. That's the approach I originally implemented in 2.5, but I grew disgusted with it every time I thought of partial truncation trundling twice through truncate_inode_pages (it can easily be avoided when nrpages == 0, but that's unlikely in partial truncation).

Quoted 5 lines

So VM_PAGEIN flag stuff to restrict it to when it might be necessary; extended to cover other races when reading the page at the same time as truncating (though I think generic_file_read has a window of this kind that we've never worried about). I expect to split the patch into several before sending Marcelo and Andrew.

And here is the patch I claimed to be below.
If you apply it to anything other than 2.4.22-pre6aa1, please be careful to check that it has applied correctly. Originally I made a patch against 2.4.22-pre6, and then applied to 2.4.22-pre6aa1: but I have never seen patch make such a mess of it!

Hugh

mm/shmem.c +34 -8
@@ -92,6 +92,9 @@
 
 #define VM_ACCT(size)    (PAGE_CACHE_ALIGN(size) >> PAGE_SHIFT)
 
+/* info->flags needs a VM_flag to handle pagein/truncate race efficiently */
+#define VM_PAGEIN	 VM_READ
+
 /* Pretend that each entry is of this size in directory's i_size */
 #define BOGO_DIRENT_SIZE 20
 
@@ -435,6 +438,18 @@
 
 	BUG_ON(info->swapped > info->next_index);
 	spin_unlock(&info->lock);
+
+	if (inode->i_mapping->nrpages && (info->flags & VM_PAGEIN)) {
+		/*
+		 * Call truncate_inode_pages again: racing shmem_unuse_inode
+		 * may have swizzled a page in from swap since vmtruncate or
+		 * generic_delete_inode did it, before we lowered next_index.
+		 * Also, though shmem_getpage checks i_size before adding to
+		 * cache, no recheck after: so fix the narrow window there too.
+		 */
+		truncate_inode_pages(inode->i_mapping, inode->i_size);
+	}
+
 	if (freed)
 		shmem_free_blocks(inode, freed);
 }
@@ -459,6 +474,19 @@
 					attr->ia_size>>PAGE_CACHE_SHIFT,
 						&page, SGP_READ);
 			}
+			/*
+			 * Reset VM_PAGEIN flag so that shmem_truncate can
+			 * detect if any pages might have been added to cache
+			 * after truncate_inode_pages.  But we needn't bother
+			 * if it's being fully truncated to zero-length: the
+			 * nrpages check is efficient enough in that case.
+			 */
+			if (attr->ia_size) {
+				struct shmem_inode_info *info = SHMEM_I(inode);
+				spin_lock(&info->lock);
+				info->flags &= ~VM_PAGEIN;
+				spin_unlock(&info->lock);
+			}
 		}
 	}
 
@@ -511,7 +539,6 @@
 	struct address_space *mapping;
 	swp_entry_t *ptr;
 	unsigned long idx;
-	unsigned long limit;
 	int offset;
 
 	idx = 0;
@@ -543,13 +570,9 @@
 	inode = info->inode;
 	mapping = inode->i_mapping;
 	delete_from_swap_cache(page);
-
-	/* Racing against delete or truncate? Must leave out of page cache */
-	limit = (inode->i_state & I_FREEING)? 0:
-		(inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-
-	if (idx >= limit || add_to_page_cache_unique(page,
-			mapping, idx, page_hash(mapping, idx)) == 0) {
+	if (add_to_page_cache_unique(page,
+		 	mapping, idx, page_hash(mapping, idx)) == 0) {
+		info->flags |= VM_PAGEIN;
 		ptr[offset].val = 0;
 		info->swapped--;
 	} else if (add_to_swap_cache(page, entry) != 0)
@@ -634,6 +657,7 @@
 		 * Add page back to page cache, unref swap, try again.
 		 */
 		add_to_page_cache_locked(page, mapping, index);
+		info->flags |= VM_PAGEIN;
 		spin_unlock(&info->lock);
 		swap_free(swap);
 		goto getswap;
@@ -809,6 +833,7 @@
 			swap_free(swap);
 		} else if (add_to_page_cache_unique(swappage,
 			mapping, idx, page_hash(mapping, idx)) == 0) {
+			info->flags |= VM_PAGEIN;
 			entry->val = 0;
 			info->swapped--;
 			spin_unlock(&info->lock);
@@ -868,6 +893,7 @@
 					goto failed;
 				goto repeat;
 			}
+			info->flags |= VM_PAGEIN;
 		}
 
 		spin_unlock(&info->lock);
#8 lore raw

Hi Hugh and Andrew,

Quoted 14 lines · Hugh Dickins
Quoted 7 lines · Hugh Dickins

Or, as in the patch Sergey is currently testing below, shmem_truncate must be prepared to truncate_inode_pages again. That's the approach I originally implemented in 2.5, but I grew disgusted with it every time I thought of partial truncation trundling twice through truncate_inode_pages (it can easily be avoided when nrpages == 0, but that's unlikely in partial truncation).

Quoted 5 lines

So VM_PAGEIN flag stuff to restrict it to when it might be necessary; extended to cover other races when reading the page at the same time as truncating (though I think generic_file_read has a window of this kind that we've never worried about). I expect to split the patch into several before sending Marcelo and Andrew.

Quoted 5 lines

And here is the patch I claimed to be below.
If you apply it to anything other than 2.4.22-pre6aa1, please be careful to check that it has applied correctly. Originally I made a patch against 2.4.22-pre6, and then applied to 2.4.22-pre6aa1: but I have never seen patch make such a mess of it!

I just want to confirm that I wasn't able to repeat this problem with the patch below (applied to 2.4.22-pre7aa1) after more than 3 days of testing. I'll inform you if any issues will arise. Thank you!

Quoted 103 lines

Hugh

mm/shmem.c +33 -8
@@ -92,6 +92,9 @@
 
 #define VM_ACCT(size)    (PAGE_CACHE_ALIGN(size) >> PAGE_SHIFT)
 
+/* info->flags needs a VM_flag to handle pagein/truncate race efficiently
 */ +#define VM_PAGEIN	 VM_READ
+
 /* Pretend that each entry is of this size in directory's i_size */
 #define BOGO_DIRENT_SIZE 20
@@ -435,6 +438,18 @@
 
 	BUG_ON(info->swapped > info->next_index);
 	spin_unlock(&info->lock);
+
+	if (inode->i_mapping->nrpages && (info->flags & VM_PAGEIN)) {
+		/*
+		 * Call truncate_inode_pages again: racing shmem_unuse_inode
+		 * may have swizzled a page in from swap since vmtruncate or
+		 * generic_delete_inode did it, before we lowered next_index.
+		 * Also, though shmem_getpage checks i_size before adding to
+		 * cache, no recheck after: so fix the narrow window there too.
+		 */
+		truncate_inode_pages(inode->i_mapping, inode->i_size);
+	}
+
 	if (freed)
 		shmem_free_blocks(inode, freed);
 }
@@ -459,6 +474,19 @@
 					attr->ia_size>>PAGE_CACHE_SHIFT,
 						&page, SGP_READ);
 			}
+			/*
+			 * Reset VM_PAGEIN flag so that shmem_truncate can
+			 * detect if any pages might have been added to cache
+			 * after truncate_inode_pages.  But we needn't bother
+			 * if it's being fully truncated to zero-length: the
+			 * nrpages check is efficient enough in that case.
+			 */
+			if (attr->ia_size) {
+				struct shmem_inode_info *info = SHMEM_I(inode);
+				spin_lock(&info->lock);
+				info->flags &= ~VM_PAGEIN;
+				spin_unlock(&info->lock);
+			}
 		}
 	}
 
@@ -511,7 +539,6 @@
 	struct address_space *mapping;
 	swp_entry_t *ptr;
 	unsigned long idx;
-	unsigned long limit;
 	int offset;
 
 	idx = 0;
@@ -543,13 +570,9 @@
 	inode = info->inode;
 	mapping = inode->i_mapping;
 	delete_from_swap_cache(page);
-
-	/* Racing against delete or truncate? Must leave out of page cache */
-	limit = (inode->i_state & I_FREEING)? 0:
-		(inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-
-	if (idx >= limit || add_to_page_cache_unique(page,
-			mapping, idx, page_hash(mapping, idx)) == 0) {
+	if (add_to_page_cache_unique(page,
+		 	mapping, idx, page_hash(mapping, idx)) == 0) {
+		info->flags |= VM_PAGEIN;
 		ptr[offset].val = 0;
 		info->swapped--;
 	} else if (add_to_swap_cache(page, entry) != 0)
@@ -634,6 +657,7 @@
 		 * Add page back to page cache, unref swap, try again.
 		 */
 		add_to_page_cache_locked(page, mapping, index);
+		info->flags |= VM_PAGEIN;
 		spin_unlock(&info->lock);
 		swap_free(swap);
 		goto getswap;
@@ -809,6 +833,7 @@
 			swap_free(swap);
 		} else if (add_to_page_cache_unique(swappage,
 			mapping, idx, page_hash(mapping, idx)) == 0) {
+			info->flags |= VM_PAGEIN;
 			entry->val = 0;
 			info->swapped--;
 			spin_unlock(&info->lock);
@@ -868,6 +893,7 @@
 					goto failed;
 				goto repeat;
 			}
+			info->flags |= VM_PAGEIN;
 		}
 
 		spin_unlock(&info->lock);
Signature · 3 lines
                   Best regards,
                   Sergey S. Kostyliov <[email protected]>
                   Public PGP key: http://sysadminday.org.ru/rathamahata.asc