From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Harry Yoo <harry.yoo@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Daniel Axtens <dja@axtens.net>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kasan-dev@googlegroups.com, linux-s390@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v7 1/1] kasan: Avoid sleepable page allocation from atomic context
Date: Mon, 12 May 2025 18:31:30 +0200 [thread overview]
Message-ID: <aCIiYgeQcvO+VQzy@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com> (raw)
In-Reply-To: <aCIUz3_9WoSFH9Hp@harry>
On Tue, May 13, 2025 at 12:33:35AM +0900, Harry Yoo wrote:
> Thanks for the update, but I don't think nr_populated is sufficient
> here. If nr_populated in the last iteration is smaller than its value
> in any previous iteration, it could lead to a memory leak.
>
> That's why I suggested (PAGE_SIZE / sizeof(data.pages[0])).
> ...but on second thought maybe touching the whole array is not
> efficient either.
Yes, I did not like it and wanted to limit the number of pages,
but did not realize that using nr_populated still could produce
leaks. In addition I could simply do:
max_populted = max(max_populted, nr_populated);
...
free_pages_bulk(data.pages, max_populated);
> If this ends up making things complicated probably we should just
> merge v6 instead (v6 looks good)? micro-optimizing vmalloc shadow memory
> population doesn't seem worth it if it comes at the cost of complexity :)
v6 is okay, except that in v7 I use break instead of return:
ret = apply_to_page_range(...);
if (ret)
break;
and as result can call the final:
free_page((unsigned long)data.pages);
Frankly, I do not have strong opinion.
> --
> Cheers,
> Harry / Hyeonggon
Thanks!
next prev parent reply other threads:[~2025-05-12 16:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 14:27 [PATCH v7 0/1] " Alexander Gordeev
2025-05-12 14:27 ` [PATCH v7 1/1] " Alexander Gordeev
2025-05-12 15:33 ` Harry Yoo
2025-05-12 16:31 ` Alexander Gordeev [this message]
2025-05-13 0:30 ` Harry Yoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aCIiYgeQcvO+VQzy@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dja@axtens.net \
--cc=harry.yoo@oracle.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox