[v2,1/2] PM: hibernate: fix spelling mistake for annotation

Message ID 20221104054119.1946073-2-tgsp002@gmail.com
State New
Headers
Series Fixes to the hibernate_preallocate_memory() |

Commit Message

TGSP Nov. 4, 2022, 5:41 a.m. UTC
  From: xiongxin <xiongxin@kylinos.cn>

The actual calculation formula in the code below is:

max_size = (count - (size + PAGES_FOR_IO)) / 2
	    - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE);

But function comments are written differently, the comment is wrong?

By the way, what exactly do the "/ 2" and "2 *" mean?

Cc: stable@vger.kernel.org
Signed-off-by: xiongxin <xiongxin@kylinos.cn>
---
 kernel/power/snapshot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Greg KH Nov. 4, 2022, 9:18 a.m. UTC | #1
On Fri, Nov 04, 2022 at 01:41:18PM +0800, TGSP wrote:
> From: xiongxin <xiongxin@kylinos.cn>
> 
> The actual calculation formula in the code below is:
> 
> max_size = (count - (size + PAGES_FOR_IO)) / 2
> 	    - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE);
> 
> But function comments are written differently, the comment is wrong?
> 
> By the way, what exactly do the "/ 2" and "2 *" mean?
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: xiongxin <xiongxin@kylinos.cn>

Please do not use an anonymous gmail account for your corporate work
like this.  Work with your company email admins to allow you to send
patches from that address so that they can be verified to actually come
from there.

thanks,

greg k-h
  
TGSP Nov. 4, 2022, 9:47 a.m. UTC | #2
在 2022/11/4 17:18, Greg KH 写道:
> On Fri, Nov 04, 2022 at 01:41:18PM +0800, TGSP wrote:
>> From: xiongxin <xiongxin@kylinos.cn>
>>
>> The actual calculation formula in the code below is:
>>
>> max_size = (count - (size + PAGES_FOR_IO)) / 2
>> 	    - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE);
>>
>> But function comments are written differently, the comment is wrong?
>>
>> By the way, what exactly do the "/ 2" and "2 *" mean?
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: xiongxin <xiongxin@kylinos.cn>
> 
> Please do not use an anonymous gmail account for your corporate work
> like this.  Work with your company email admins to allow you to send
> patches from that address so that they can be verified to actually come
> from there.
> 
> thanks,
> 
> greg k-h

I also wanted to send it directly through the company mailbox, but those 
leaders didn't take it seriously.

Next time I don't use the company email and submit patches as I can as a 
freelancer.
  

Patch

diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 2a406753af90..c20ca5fb9adc 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1723,8 +1723,8 @@  static unsigned long minimum_image_size(unsigned long saveable)
  * /sys/power/reserved_size, respectively).  To make this happen, we compute the
  * total number of available page frames and allocate at least
  *
- * ([page frames total] + PAGES_FOR_IO + [metadata pages]) / 2
- *  + 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE)
+ * ([page frames total] - PAGES_FOR_IO - [metadata pages]) / 2
+ *  - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE)
  *
  * of them, which corresponds to the maximum size of a hibernation image.
  *