lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <08fccb39-1405-4aa9-884b-b28a5f7aad59@linux.alibaba.com>
Date: Sat, 18 Jan 2025 11:29:25 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Jens Axboe <axboe@...nel.dk>, linux-mm@...ck.org,
 linux-fsdevel@...r.kernel.org
Cc: hannes@...xchg.org, clm@...a.com, linux-kernel@...r.kernel.org,
 willy@...radead.org, kirill@...temov.name, bfoster@...hat.com
Subject: Re: [PATCH 09/12] mm/filemap: drop streaming/uncached pages when
 writeback completes



On 12/20/24 11:47 PM, Jens Axboe wrote:
> If the folio is marked as streaming, drop pages when writeback completes.
> Intended to be used with RWF_DONTCACHE, to avoid needing sync writes for
> uncached IO.
> 
> Signed-off-by: Jens Axboe <axboe@...nel.dk>
> ---
>  mm/filemap.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index dd563208d09d..aa0b3af6533d 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1599,6 +1599,27 @@ int folio_wait_private_2_killable(struct folio *folio)
>  }
>  EXPORT_SYMBOL(folio_wait_private_2_killable);
>  
> +/*
> + * If folio was marked as dropbehind, then pages should be dropped when writeback
> + * completes. Do that now. If we fail, it's likely because of a big folio -
> + * just reset dropbehind for that case and latter completions should invalidate.
> + */
> +static void folio_end_dropbehind_write(struct folio *folio)
> +{
> +	/*
> +	 * Hitting !in_task() should not happen off RWF_DONTCACHE writeback,
> +	 * but can happen if normal writeback just happens to find dirty folios
> +	 * that were created as part of uncached writeback, and that writeback
> +	 * would otherwise not need non-IRQ handling. Just skip the
> +	 * invalidation in that case.
> +	 */
> +	if (in_task() && folio_trylock(folio)) {
> +		if (folio->mapping)
> +			folio_unmap_invalidate(folio->mapping, folio, 0);
> +		folio_unlock(folio);
> +	}
> +}

Sorry shouldn't folio_end_writeback() be called from IRQ context (of the
block device) when the IO completes?  This may be a stupid question, but
I just can't understand that...

-- 
Thanks,
Jingbo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ