Re: [PATCH v14 072/138] mm/writeback: Add folio_account_cleaned()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/15/21 5:35 AM, Matthew Wilcox (Oracle) wrote:
> Get the statistics right; compound pages were being accounted as a
> single page.  This didn't matter before now as no filesystem which
> supported compound pages did writeback.  Also move the declaration
> to filemap.h since this is part of the page cache.  Add a wrapper for

Seems to be pagemap.h :)

> account_page_cleaned().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Nit below:
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index bd97c461d499..792a83bd3917 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2453,14 +2453,15 @@ static void folio_account_dirtied(struct folio *folio,
>   *
>   * Caller must hold lock_page_memcg().
>   */
> -void account_page_cleaned(struct page *page, struct address_space *mapping,
> +void folio_account_cleaned(struct folio *folio, struct address_space *mapping,
>  			  struct bdi_writeback *wb)
>  {
>  	if (mapping_can_writeback(mapping)) {
> -		dec_lruvec_page_state(page, NR_FILE_DIRTY);
> -		dec_zone_page_state(page, NR_ZONE_WRITE_PENDING);
> -		dec_wb_stat(wb, WB_RECLAIMABLE);
> -		task_io_account_cancelled_write(PAGE_SIZE);
> +		long nr = folio_nr_pages(folio);
> +		lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, -nr);
> +		zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr);
> +		wb_stat_mod(wb, WB_RECLAIMABLE, -nr);
> +		task_io_account_cancelled_write(folio_size(folio));

In "mm/writeback: Add __folio_mark_dirty()" you used nr*PAGE_SIZE. Consistency?

>  	}
>  }
>  
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux