Re: [PATCH v2 2/6] shmem: return freed pages in shmem_free_swap

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

 



On Tue, Sep 19, 2023 at 01:55:47PM +0000, Daniel Gomez wrote:
> +++ b/mm/shmem.c
> @@ -846,16 +846,18 @@ static void shmem_delete_from_page_cache(struct folio *folio, void *radswap)
>  /*
>   * Remove swap entry from page cache, free the swap and its page cache.
>   */
> -static int shmem_free_swap(struct address_space *mapping,
> +static long shmem_free_swap(struct address_space *mapping,
>  			   pgoff_t index, void *radswap)
>  {
>  	void *old;
>  
>  	old = xa_cmpxchg_irq(&mapping->i_pages, index, radswap, NULL, 0);
>  	if (old != radswap)
> -		return -ENOENT;
> +		return 0;
> +
>  	free_swap_and_cache(radix_to_swp_entry(radswap));
> -	return 0;
> +
> +	return folio_nr_pages((struct folio *)radswap);
>  }

Oh my goodness.  I have led you astray; my apologies.

shmem_free_swap() is called when the 'folio' is NOT actually a folio.
It's an 'exceptional' / 'value' entry.  We can't do this.

Do we encode the size of the swap entry in the swp_entry_t or do
we have to get that information from the XArray (which no longer
knows it after we've stored a NULL there)?




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

  Powered by Linux