Tetsuo Handa
2018-Aug-03 12:11 UTC
[PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
On 2018/08/03 17:32, Wei Wang wrote:> +static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) > +{ > + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; > + vb->shrinker.count_objects = virtio_balloon_shrinker_count; > + vb->shrinker.batch = 0; > + vb->shrinker.seeks = DEFAULT_SEEKS;Why flags field is not set? If vb is allocated by kmalloc(GFP_KERNEL) and is nowhere zero-cleared, KASAN would complain it.> + > + return register_shrinker(&vb->shrinker); > +}
Wei Wang
2018-Aug-06 09:56 UTC
[PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
On 08/03/2018 08:11 PM, Tetsuo Handa wrote:> On 2018/08/03 17:32, Wei Wang wrote: >> +static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) >> +{ >> + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; >> + vb->shrinker.count_objects = virtio_balloon_shrinker_count; >> + vb->shrinker.batch = 0; >> + vb->shrinker.seeks = DEFAULT_SEEKS; > Why flags field is not set? If vb is allocated by kmalloc(GFP_KERNEL) > and is nowhere zero-cleared, KASAN would complain it.Could you point where in the code that would complain it? I only see two shrinker flags (NUMA_AWARE and MEMCG_AWARE), and they seem not related to that. Best, Wei
Tetsuo Handa
2018-Aug-06 10:29 UTC
[PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
On 2018/08/06 18:56, Wei Wang wrote:> On 08/03/2018 08:11 PM, Tetsuo Handa wrote: >> On 2018/08/03 17:32, Wei Wang wrote: >>> +static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) >>> +{ >>> +??? vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; >>> +??? vb->shrinker.count_objects = virtio_balloon_shrinker_count; >>> +??? vb->shrinker.batch = 0; >>> +??? vb->shrinker.seeks = DEFAULT_SEEKS; >> Why flags field is not set? If vb is allocated by kmalloc(GFP_KERNEL) >> and is nowhere zero-cleared, KASAN would complain it. > > Could you point where in the code that would complain it? > I only see two shrinker flags (NUMA_AWARE and MEMCG_AWARE), and they seem not related to that.Where is vb->shrinker.flags initialized?
Reasonably Related Threads
- [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
- [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
- [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
- [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker
- [PATCH v1 0/3] virtio-balloon: Fixes + switch back to OOM handler