lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17615a07-f9fb-49bd-ad56-df6691c3d362@redhat.com>
Date: Mon, 22 Apr 2024 11:09:52 +0200
From: David Hildenbrand <david@...hat.com>
To: zhenwei pi <pizhenwei@...edance.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, virtualization@...ts.linux.dev
Cc: mst@...hat.com, jasowang@...hat.com, xuanzhuo@...ux.alibaba.com,
 akpm@...ux-foundation.org
Subject: Re: [PATCH v2 1/4] virtio_balloon: separate vm events into a function

On 22.04.24 10:04, zhenwei pi wrote:
> 
> 
> On 4/22/24 15:47, David Hildenbrand wrote:
>> On 22.04.24 09:42, zhenwei pi wrote:
>>> All the VM events related statistics have dependence on
>>> 'CONFIG_VM_EVENT_COUNTERS', once any stack variable is required by any
>>> VM events in future, we would have codes like:
>>>    #ifdef CONFIG_VM_EVENT_COUNTERS
>>>         unsigned long foo;
>>>    #endif
>>>         ...
>>>    #ifdef CONFIG_VM_EVENT_COUNTERS
>>>         foo = events[XXX] + events[YYY];
>>>         update_stat(vb, idx++, VIRTIO_BALLOON_S_XXX, foo);
>>>    #endif
>>>
>>> Separate vm events into a single function, also remove
>>
>> Why not simply use __maybe_unused for that variable?
>>
> 
> 1>
> static unsigned int update_balloon_stats()
> {
>       unsigned __maybe_unused long foo;
> 
>       ...
> #ifdef CONFIG_VM_EVENT_COUNTERS
>       foo = events[XXX] + events[YYY];
>       update_stat(vb, idx++, VIRTIO_BALLOON_S_XXX, foo);
> #endif
> }
> 
> 2>
> static inline unsigned int update_balloon_vm_stats()
> {
> #ifdef CONFIG_VM_EVENT_COUNTERS
>       unsigned long foo;
> 
>       foo = events[XXX] + events[YYY];
>       update_stat(vb, idx++, VIRTIO_BALLOON_S_XXX, foo);
> #endif
> }
> 
>   From the point of my view, I don't need to compile code in my brain
> when reading codes for case 2. :)

But for #1? :)

I mean, you didn't compile the code in your brain when you sent out v1 :P

But I agree that moving that to a separate function ins cleaner, staring 
at resulting update_balloon_stats().

Let me comment on some nits as a fresh reply.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ