Re: [PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization.

2024-06-06 Thread cuitao
Sorry, maybe I'm wrong. I wonder if the gfp parameter in static inline void *kmalloc(size_t s, gfp_t gfp) can be deleted if it is not used. Or would be better to move memset to kmalloc. Like this: #define __GFP_ZERO 0x1 static inline void *kmalloc(size_t s, gfp_t gfp) {     void *p;     if (_

Re: [PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization.

2024-06-06 Thread Michael S. Tsirkin
On Wed, Jun 05, 2024 at 09:52:45PM +0800, cuitao wrote: > Use the __GFP_ZERO flag of kmalloc to initialize memory while allocating it, > without the need for an additional memset call. > > Signed-off-by: cuitao > --- > tools/virtio/linux/kernel.h | 5 + > 1 file changed, 1 insertion(+), 4 de

回复: Re: [PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization.

2024-06-05 Thread 崔涛
(__kmalloc_fake) return __kmalloc_fake;   p = malloc(s); if (!p)         return p;   if (gfp & __GFP_ZERO) memset(p, 0, s); return p; }   主 题:Re: [PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization. 日 期:2024-06-06 08:29 发件人:jasowang 收件

Re: [PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization.

2024-06-05 Thread Jason Wang
On Wed, Jun 5, 2024 at 9:56 PM cuitao wrote: > > Use the __GFP_ZERO flag of kmalloc to initialize memory while allocating it, > without the need for an additional memset call. > > Signed-off-by: cuitao > --- > tools/virtio/linux/kernel.h | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-

[PATCH] tools/virtio: Use the __GFP_ZERO flag of kmalloc to complete the memory initialization.

2024-06-05 Thread cuitao
Use the __GFP_ZERO flag of kmalloc to initialize memory while allocating it, without the need for an additional memset call. Signed-off-by: cuitao --- tools/virtio/linux/kernel.h | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/li