Re: + mm-add-__dump_folio-fix-3.patch added to mm-unstable branch

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

 



On Mon, 04 Mar 2024 11:11:28 -0800 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> --- a/mm/debug.c~mm-add-__dump_folio-fix-3
> +++ a/mm/debug.c
> @@ -121,23 +121,31 @@ static void __dump_page(const struct pag
>  again:
>  	memcpy(&precise, page, sizeof(*page));
>  	foliop = page_folio(&precise);
> -	idx = folio_page_idx(foliop, page);
> -	if (idx != 0) {
> -		if (idx < MAX_FOLIO_NR_PAGES) {
> -			memcpy(&folio, foliop, 2 * sizeof(struct page));
> -			nr_pages = folio_nr_pages(&folio);
> -		}
> +	if (foliop == (struct folio *)&precise) {
> +		idx = 0;
> +		if (!folio_test_large(foliop))
> +			goto dump;
> +		foliop = (struct folio *)page;
> +	} else {
> +		idx = folio_page_idx(foliop, page);
> +	}
> +
> +	if (idx < MAX_FOLIO_NR_PAGES) {
> +		memcpy(&folio, foliop, 2 * sizeof(struct page));
> +		nr_pages = folio_nr_pages(&folio);
> +		foliop = &folio;
> +	}
>  
> -		if (idx > nr_pages) {
> -			if (loops-- > 0)
> -				goto again;
> -			printk("page does not match folio\n");
> -			precise.compound_head &= ~1UL;
> -			foliop = (struct folio *)&precise;
> -			idx = 0;
> -		}
> +	if (idx > nr_pages) {
> +		if (loops-- > 0)
> +			goto again;
> +		printk("page does not match folio\n");

We shouldn't use a bare printk().  I'll make it pr_warn(), but should
we be using WARN() here to get a backtrace?

> +		precise.compound_head &= ~1UL;
> +		foliop = (struct folio *)&precise;
> +		idx = 0;
>  	}





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux