linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
@ 2013-03-18 10:21 Lin Feng
  2013-03-18 17:52 ` Yinghai Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Lin Feng @ 2013-03-18 10:21 UTC (permalink / raw)
  To: akpm, bhelgaas; +Cc: linux-mm, x86, linux-pci, linux-kernel, yinghai, Lin Feng

If we fall into that branch it means that there is a range fully covering the
subtract range, so it's suffice to return there if there isn't any other
overlapping ranges.

Also fix the broken phrase issued by printk.

Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
---
 kernel/range.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/range.c b/kernel/range.c
index 9b8ae2d..223c6fe 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
 				range[i].end = range[j].end;
 				range[i].start = end;
 			} else {
-				printk(KERN_ERR "run of slot in ranges\n");
+				printk(KERN_ERR "run out of slot in ranges\n");
 			}
 			range[j].end = start;
-			continue;
+			return;
 		}
 	}
 }
-- 
1.8.0.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
  2013-03-18 10:21 [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops Lin Feng
@ 2013-03-18 17:52 ` Yinghai Lu
  2013-03-19  3:54   ` [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk Lin Feng
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2013-03-18 17:52 UTC (permalink / raw)
  To: Lin Feng; +Cc: akpm, bhelgaas, linux-mm, x86, linux-pci, linux-kernel

On Mon, Mar 18, 2013 at 3:21 AM, Lin Feng <linfeng@cn.fujitsu.com> wrote:
> If we fall into that branch it means that there is a range fully covering the
> subtract range, so it's suffice to return there if there isn't any other
> overlapping ranges.
>
> Also fix the broken phrase issued by printk.
>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
> ---
>  kernel/range.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/range.c b/kernel/range.c
> index 9b8ae2d..223c6fe 100644
> --- a/kernel/range.c
> +++ b/kernel/range.c
> @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
>                                 range[i].end = range[j].end;
>                                 range[i].start = end;
>                         } else {
> -                               printk(KERN_ERR "run of slot in ranges\n");
> +                               printk(KERN_ERR "run out of slot in ranges\n");

maybe could change to pr_err at the same time.

>                         }
>                         range[j].end = start;
> -                       continue;
> +                       return;

We don't say that ranges can not be overlapped in the array.

Thanks

Yinghai

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk
  2013-03-18 17:52 ` Yinghai Lu
@ 2013-03-19  3:54   ` Lin Feng
  2013-03-27 17:27     ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Lin Feng @ 2013-03-19  3:54 UTC (permalink / raw)
  To: akpm, bhelgaas; +Cc: linux-mm, x86, linux-pci, linux-kernel, yinghai, Lin Feng

Also replace deprecated printk(KERN_ERR...) with pr_err() as suggested
by Yinghai, attaching the function name to provide plenty info.

Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
---
 kernel/range.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/range.c b/kernel/range.c
index 9b8ae2d..071b0ab 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -97,7 +97,8 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
 				range[i].end = range[j].end;
 				range[i].start = end;
 			} else {
-				printk(KERN_ERR "run of slot in ranges\n");
+				pr_err("%s: run out of slot in ranges\n",
+					__func__);
 			}
 			range[j].end = start;
 			continue;
-- 
1.8.0.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk
  2013-03-19  3:54   ` [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk Lin Feng
@ 2013-03-27 17:27     ` Bjorn Helgaas
  2013-03-27 17:51       ` Yinghai Lu
  2013-03-28  1:49       ` Lin Feng
  0 siblings, 2 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2013-03-27 17:27 UTC (permalink / raw)
  To: Lin Feng
  Cc: Andrew Morton, linux-mm, x86@kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yinghai Lu

On Mon, Mar 18, 2013 at 9:54 PM, Lin Feng <linfeng@cn.fujitsu.com> wrote:
> Also replace deprecated printk(KERN_ERR...) with pr_err() as suggested
> by Yinghai, attaching the function name to provide plenty info.
>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
> ---
>  kernel/range.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/range.c b/kernel/range.c
> index 9b8ae2d..071b0ab 100644
> --- a/kernel/range.c
> +++ b/kernel/range.c
> @@ -97,7 +97,8 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
>                                 range[i].end = range[j].end;
>                                 range[i].start = end;
>                         } else {
> -                               printk(KERN_ERR "run of slot in ranges\n");
> +                               pr_err("%s: run out of slot in ranges\n",
> +                                       __func__);
>                         }
>                         range[j].end = start;
>                         continue;

So now the user might see:

    subtract_range: run out of slot in ranges

What is the user supposed to do when he sees that?  If he happens to
mention it on LKML, what are we going to do about it?  If he attaches
the complete dmesg log, is there enough information to do something?

IMHO, that message is still totally useless.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk
  2013-03-27 17:27     ` Bjorn Helgaas
@ 2013-03-27 17:51       ` Yinghai Lu
  2013-03-28  1:49       ` Lin Feng
  1 sibling, 0 replies; 6+ messages in thread
From: Yinghai Lu @ 2013-03-27 17:51 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lin Feng, Andrew Morton, linux-mm, x86@kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org

On Wed, Mar 27, 2013 at 10:27 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:

> So now the user might see:
>
>     subtract_range: run out of slot in ranges
>
> What is the user supposed to do when he sees that?  If he happens to
> mention it on LKML, what are we going to do about it?  If he attaches
> the complete dmesg log, is there enough information to do something?
>
> IMHO, that message is still totally useless.

Change to WARN_ONCE?

Yinghai

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk
  2013-03-27 17:27     ` Bjorn Helgaas
  2013-03-27 17:51       ` Yinghai Lu
@ 2013-03-28  1:49       ` Lin Feng
  1 sibling, 0 replies; 6+ messages in thread
From: Lin Feng @ 2013-03-28  1:49 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Andrew Morton, linux-mm, x86@kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yinghai Lu

Hi Bjorn and others,

On 03/28/2013 01:27 AM, Bjorn Helgaas wrote:
>> -                               printk(KERN_ERR "run of slot in ranges\n");
>> > +                               pr_err("%s: run out of slot in ranges\n",
>> > +                                       __func__);
>> >                         }
>> >                         range[j].end = start;
>> >                         continue;
> So now the user might see:
> 
>     subtract_range: run out of slot in ranges
> 
> What is the user supposed to do when he sees that?  If he happens to
> mention it on LKML, what are we going to do about it?  If he attaches
> the complete dmesg log, is there enough information to do something?
> 
> IMHO, that message is still totally useless.
> 

Yes, we need to issue some useful message. 
How about dump_stack() there so that we can find some clues more since
subtract_range() is called mtrr_bp_init path and pci relative path, then
it may help to instruct us to do something ;-) ?

thanks,
linfeng

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-28  1:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18 10:21 [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops Lin Feng
2013-03-18 17:52 ` Yinghai Lu
2013-03-19  3:54   ` [PATCH] kernel/range.c: subtract_range: fix the broken phrase issued by printk Lin Feng
2013-03-27 17:27     ` Bjorn Helgaas
2013-03-27 17:51       ` Yinghai Lu
2013-03-28  1:49       ` Lin Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).