Skip to contentSkip to conversation

New: wrong count of dirty pages when using AIO

Bug 86831 Andrew Morton 1 participant 1 message Oct 27, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Andrew Morton

author maintainer
#1 lore raw
In reply to a message not in the archive

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 29 lines · On Fri, 24 Oct 2014 15:33:02 +0000 [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=86831

            Bug ID: 86831
           Summary: wrong count of dirty pages when using AIO
           Product: Memory Management
           Version: 2.5
    Kernel Version: 3.14.21
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Hello,

we use a ARM custom Board with mysqld. Shuting down mysqld (with IAO support, on a ext3 formatted Harddrive) leads to a negative number of dirty pages (underrun to the counter). The negative number results in a drastic reduction of the write performance because the page cache is not used, because the kernel thinks it is still 2 ^ 32 dirty pages open. I found, the problem is mm/truncate.c->cancel_dirty_page()

To reproduce,first change cancel_dirty_page()

Quoted 7 lines

[...]
if (mapping && mapping_cap_account_dirty (mapping)) { ++WARN_ON ((int) global_page_state(NR_FILE_DIRTY) <0); dec_zone_page_state (page, NR_FILE_DIRTY); [...]

And test ->

hm, I wonder what AIO is doing differently - cancel_dirty_page() isn't specific to aio - it's used by all truncations.

Just to sanity check, could you please try something like this?

include/linux/vmstat.h renamed from include/linux/vmstat.h~a +2 -0
@@ -241,6 +241,8 @@ static inline void __inc_zone_state(stru
 static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
 {
 	atomic_long_dec(&zone->vm_stat[item]);
+	WARN_ON_ONCE(item == NR_FILE_DIRTY &&
+		atomic_long_read(&zone->vm_stat[item]) < 0);
 	atomic_long_dec(&vm_stat[item]);
 }
 

That should catch the first offending decrement, although yes, it's probably cancel_dirty_page().

(This assumes you're using an SMP kernel. If not, mm/vmstat.c:dec_zone_page_state() will need to be changed instead)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>