Re: [RFC] iomap: use huge zero folio in iomap_dio_zero

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

 



Christoph Hellwig <hch@xxxxxxxxxxxxx> writes:

> On Tue, May 07, 2024 at 04:58:12PM +0200, Pankaj Raghav (Samsung) wrote:
>> +	if (len > PAGE_SIZE) {
>> +		folio = mm_get_huge_zero_folio(current->mm);
>
> I don't think the mm_struct based interfaces work well here, as I/O
> completions don't come in through the same mm.  You'll want to use

But right now iomap_dio_zero() is only called from the submission
context right i.e. iomap_dio_bio_iter(). Could you please explain the
dependency with the completion context to have same mm_struct here?

> lower level interfaces like get_huge_zero_page and use them at
> mount time.
>

Even so, should we not check whether allocation of hugepage is of any
value or not depending upon how large the length or (blocksize in case of
mount time) really is.
i.e. say if the len for zeroing is just 2 times the PAGE_SIZE, then it
doesn't really make sense to allocate a 2MB hugepage and sometimes 16MB
hugepage on some archs (like Power with hash mmu).

maybe something like if len > 16 * pagesize?

>> +		if (!folio)
>> +			folio = zero_page_folio;
>
> And then don't bother with a fallback.

The hugepage allocation can still fail during mount time (if we mount
late when the system memory is already fragmented). So we might still
need a fallback to ZERO_PAGE(0), right?

-ritesh




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux