@@ -948,6 +948,8 @@ static int zram_writeback_complete(struct zram *zram, struct zram_wb_req *req)
948948 clear_slot_flag (zram , index , ZRAM_IDLE );
949949 if (test_slot_flag (zram , index , ZRAM_HUGE ))
950950 atomic64_dec (& zram -> stats .huge_pages );
951+ if (test_slot_flag (zram , index , ZRAM_INCOMPRESSIBLE ))
952+ atomic64_dec (& zram -> stats .incompressible_pages );
951953 atomic64_sub (get_slot_size (zram , index ), & zram -> stats .compr_data_size );
952954 zs_free (zram -> mem_pool , get_slot_handle (zram , index ));
953955 set_slot_handle (zram , index , req -> blk_idx );
@@ -1908,7 +1910,7 @@ static ssize_t mm_stat_show(struct device *dev, struct device_attribute *attr,
19081910 max_used = atomic_long_read (& zram -> stats .max_used_pages );
19091911
19101912 ret = sysfs_emit (buf ,
1911- "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu\n" ,
1913+ "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8llu %8llu \n" ,
19121914 orig_size << PAGE_SHIFT ,
19131915 (u64 )atomic64_read (& zram -> stats .compr_data_size ),
19141916 mem_used << PAGE_SHIFT ,
@@ -1917,7 +1919,9 @@ static ssize_t mm_stat_show(struct device *dev, struct device_attribute *attr,
19171919 (u64 )atomic64_read (& zram -> stats .same_pages ),
19181920 atomic_long_read (& pool_stats .pages_compacted ),
19191921 (u64 )atomic64_read (& zram -> stats .huge_pages ),
1920- (u64 )atomic64_read (& zram -> stats .huge_pages_since ));
1922+ (u64 )atomic64_read (& zram -> stats .huge_pages_since ),
1923+ (u64 )atomic64_read (& zram -> stats .incompressible_pages ),
1924+ (u64 )atomic64_read (& zram -> stats .incompressible_pages_since ));
19211925
19221926 return ret ;
19231927}
@@ -1989,10 +1993,15 @@ static void slot_free(struct zram *zram, u32 index)
19891993#endif
19901994
19911995 clear_slot_flag (zram , index , ZRAM_IDLE );
1992- clear_slot_flag (zram , index , ZRAM_INCOMPRESSIBLE );
19931996 clear_slot_flag (zram , index , ZRAM_PP_SLOT );
19941997 set_slot_comp_priority (zram , index , 0 );
19951998
1999+ if (test_slot_flag (zram , index , ZRAM_INCOMPRESSIBLE )) {
2000+ if (!test_slot_flag (zram , index , ZRAM_WB ))
2001+ atomic64_dec (& zram -> stats .incompressible_pages );
2002+ clear_slot_flag (zram , index , ZRAM_INCOMPRESSIBLE );
2003+ }
2004+
19962005 if (test_slot_flag (zram , index , ZRAM_HUGE )) {
19972006 /*
19982007 * Writeback completion decrements ->huge_pages but keeps
@@ -2197,7 +2206,7 @@ static int write_same_filled_page(struct zram *zram, unsigned long fill,
21972206 return 0 ;
21982207}
21992208
2200- static int write_incompressible_page (struct zram * zram , struct page * page ,
2209+ static int write_huge_page (struct zram * zram , struct page * page ,
22012210 u32 index )
22022211{
22032212 unsigned long handle ;
@@ -2268,7 +2277,7 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
22682277
22692278 if (comp_len >= huge_class_size ) {
22702279 zcomp_stream_put (zstrm );
2271- return write_incompressible_page (zram , page , index );
2280+ return write_huge_page (zram , page , index );
22722281 }
22732282
22742283 handle = zs_malloc (zram -> mem_pool , comp_len ,
@@ -2487,6 +2496,8 @@ static int recompress_slot(struct zram *zram, u32 index, struct page *page,
24872496 if (prio < zram -> num_active_comps )
24882497 return 0 ;
24892498 set_slot_flag (zram , index , ZRAM_INCOMPRESSIBLE );
2499+ atomic64_inc (& zram -> stats .incompressible_pages );
2500+ atomic64_inc (& zram -> stats .incompressible_pages_since );
24902501 return 0 ;
24912502 }
24922503
0 commit comments