All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	Eric Biederman <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kexec: Use ALIGN macro instead of open-coding it
Date: Wed, 13 Dec 2023 10:49:08 +0800	[thread overview]
Message-ID: <ZXkbpNubH69pAjg1@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20231212142706.25149-1-ytcoode@gmail.com>

On 12/12/23 at 10:27pm, Yuntao Wang wrote:
> Use ALIGN macro instead of open-coding it to improve code readability.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  kernel/kexec_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM,

Acked-by: Baoquan He <bhe@redhat.com>

> 
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index be5642a4ec49..0113436e4a3a 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -430,7 +430,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
>  
>  	pages = NULL;
>  	size = (1 << order) << PAGE_SHIFT;
> -	hole_start = (image->control_page + (size - 1)) & ~(size - 1);
> +	hole_start = ALIGN(image->control_page, size);
>  	hole_end   = hole_start + size - 1;
>  	while (hole_end <= crashk_res.end) {
>  		unsigned long i;
> @@ -447,7 +447,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
>  			mend   = mstart + image->segment[i].memsz - 1;
>  			if ((hole_end >= mstart) && (hole_start <= mend)) {
>  				/* Advance the hole to the end of the segment */
> -				hole_start = (mend + (size - 1)) & ~(size - 1);
> +				hole_start = ALIGN(mend, size);
>  				hole_end   = hole_start + size - 1;
>  				break;
>  			}
> -- 
> 2.43.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	Eric Biederman <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kexec: Use ALIGN macro instead of open-coding it
Date: Wed, 13 Dec 2023 10:49:08 +0800	[thread overview]
Message-ID: <ZXkbpNubH69pAjg1@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20231212142706.25149-1-ytcoode@gmail.com>

On 12/12/23 at 10:27pm, Yuntao Wang wrote:
> Use ALIGN macro instead of open-coding it to improve code readability.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  kernel/kexec_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM,

Acked-by: Baoquan He <bhe@redhat.com>

> 
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index be5642a4ec49..0113436e4a3a 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -430,7 +430,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
>  
>  	pages = NULL;
>  	size = (1 << order) << PAGE_SHIFT;
> -	hole_start = (image->control_page + (size - 1)) & ~(size - 1);
> +	hole_start = ALIGN(image->control_page, size);
>  	hole_end   = hole_start + size - 1;
>  	while (hole_end <= crashk_res.end) {
>  		unsigned long i;
> @@ -447,7 +447,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
>  			mend   = mstart + image->segment[i].memsz - 1;
>  			if ((hole_end >= mstart) && (hole_start <= mend)) {
>  				/* Advance the hole to the end of the segment */
> -				hole_start = (mend + (size - 1)) & ~(size - 1);
> +				hole_start = ALIGN(mend, size);
>  				hole_end   = hole_start + size - 1;
>  				break;
>  			}
> -- 
> 2.43.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


  reply	other threads:[~2023-12-13  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 14:27 [PATCH] kexec: Use ALIGN macro instead of open-coding it Yuntao Wang
2023-12-12 14:27 ` Yuntao Wang
2023-12-13  2:49 ` Baoquan He [this message]
2023-12-13  2:49   ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXkbpNubH69pAjg1@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ytcoode@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.