* [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur
@ 2020-04-12 14:38 Liu Song
2020-04-13 15:02 ` Dave Hansen
0 siblings, 1 reply; 4+ messages in thread
From: Liu Song @ 2020-04-12 14:38 UTC (permalink / raw)
To: gregkh, jroedel, dave.hansen, tglx; +Cc: linux-mm, linux-kernel, liu.song11
From: Liu Song <liu.song11@zte.com.cn>
If overflow, should ensure that "free_vmap_cache" is set to NULL,
so as to ensure that it can be traversed from the beginning.
Signed-off-by: Liu Song <liu.song11@zte.com.cn>
---
mm/vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d8e877365f9f..2638a20d36ce 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -441,7 +441,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
if (!free_vmap_cache ||
size < cached_hole_size ||
vstart < cached_vstart ||
- align < cached_align) {
+ align < cached_align || purged) {
nocache:
cached_hole_size = 0;
free_vmap_cache = NULL;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur
2020-04-12 14:38 [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur Liu Song
@ 2020-04-13 15:02 ` Dave Hansen
2020-04-14 14:54 ` fishland
2020-04-14 19:02 ` Uladzislau Rezki
0 siblings, 2 replies; 4+ messages in thread
From: Dave Hansen @ 2020-04-13 15:02 UTC (permalink / raw)
To: Liu Song, gregkh, jroedel, dave.hansen, tglx
Cc: linux-mm, linux-kernel, liu.song11
On 4/12/20 7:38 AM, Liu Song wrote:
> If overflow, should ensure that "free_vmap_cache" is set to NULL,
> so as to ensure that it can be traversed from the beginning.
This changelog is a bit sparse.
Does this fix a demonstrated problem? Or was it just discovered via
code review and assumed to help a theoretical problem?
Which tree is it against? 'free_vmap_cache' doesn't show up in Linus's
tree.
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d8e877365f9f..2638a20d36ce 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -441,7 +441,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> if (!free_vmap_cache ||
> size < cached_hole_size ||
> vstart < cached_vstart ||
> - align < cached_align) {
> + align < cached_align || purged) {
> nocache:
> cached_hole_size = 0;
> free_vmap_cache = NULL;
Is 'purged' the right way to do this?
There is a path through the overflow code that also sets purged=0. Does
'free_vmap_cache' *not* need to get reset in that case?
It also seems more natural to me that the code mucking with the rbtree
would be the one to reset the cache.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur
2020-04-13 15:02 ` Dave Hansen
@ 2020-04-14 14:54 ` fishland
2020-04-14 19:02 ` Uladzislau Rezki
1 sibling, 0 replies; 4+ messages in thread
From: fishland @ 2020-04-14 14:54 UTC (permalink / raw)
To: gregkh, jroedel, dave.hansen, tglx, Dave Hansen
Cc: linux-mm, linux-kernel, liu.song11
>On 4/12/20 7:38 AM, Liu Song wrote:
>> If overflow, should ensure that "free_vmap_cache" is set to NULL,
>> so as to ensure that it can be traversed from the beginning.
>
>This changelog is a bit sparse.
>
>Does this fix a demonstrated problem? Or was it just discovered via
>code review and assumed to help a theoretical problem?
>
>Which tree is it against? 'free_vmap_cache' doesn't show up in Linus's
>tree.
>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>> index d8e877365f9f..2638a20d36ce 100644
>> --- a/mm/vmalloc.c
>> +++ b/mm/vmalloc.c
>> @@ -441,7 +441,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
>> if (!free_vmap_cache ||
>> size < cached_hole_size ||
>> vstart < cached_vstart ||
>> - align < cached_align) {
>> + align < cached_align || purged) {
>> nocache:
>> cached_hole_size = 0;
>> free_vmap_cache = NULL;
>
>Is 'purged' the right way to do this?
>
>There is a path through the overflow code that also sets purged=0. Does
>'free_vmap_cache' *not* need to get reset in that case?
>
>It also seems more natural to me that the code mucking with the rbtree
>would be the one to reset the cache.
Hi,
Thanks for your reply, there is indeed a problem with this patch submission.
I neglected the cache clearing process, so I mistakenly thought that the cache
should be cleared after "purged". I will not issue such unconsidered patches
anymore, to avoid unnecessary trouble for everyone. *_^
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur
2020-04-13 15:02 ` Dave Hansen
2020-04-14 14:54 ` fishland
@ 2020-04-14 19:02 ` Uladzislau Rezki
1 sibling, 0 replies; 4+ messages in thread
From: Uladzislau Rezki @ 2020-04-14 19:02 UTC (permalink / raw)
To: Dave Hansen, Liu Song
Cc: Liu Song, gregkh, jroedel, dave.hansen, tglx, linux-mm,
linux-kernel, liu.song11@zte.com.cnhange-folder>?
On Mon, Apr 13, 2020 at 08:02:49AM -0700, Dave Hansen wrote:
> On 4/12/20 7:38 AM, Liu Song wrote:
> > If overflow, should ensure that "free_vmap_cache" is set to NULL,
> > so as to ensure that it can be traversed from the beginning.
>
> This changelog is a bit sparse.
>
> Does this fix a demonstrated problem? Or was it just discovered via
> code review and assumed to help a theoretical problem?
>
> Which tree is it against? 'free_vmap_cache' doesn't show up in Linus's
> tree.
> > diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> > index d8e877365f9f..2638a20d36ce 100644
> > --- a/mm/vmalloc.c
> > +++ b/mm/vmalloc.c
> > @@ -441,7 +441,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> > if (!free_vmap_cache ||
> > size < cached_hole_size ||
> > vstart < cached_vstart ||
> > - align < cached_align) {
> > + align < cached_align || purged) {
> > nocache:
> > cached_hole_size = 0;
> > free_vmap_cache = NULL;
> >
We do not have such code since 5.2 kernel or so, nor things like
cached_hole_size, free_vmap_cache and so on. It was totally reworked.
--
Vlad Rezki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-14 19:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 14:38 [RFC PATCH] mm/vmalloc: make sure to traverse from the beginning when overflow occur Liu Song
2020-04-13 15:02 ` Dave Hansen
2020-04-14 14:54 ` fishland
2020-04-14 19:02 ` Uladzislau Rezki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).