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>] [day] [month] [year] [list]
Date:	Wed, 5 Oct 2011 10:42:59 +0800
From:	Wei Yang <weiyang.kernel@...il.com>
To:	linux-kernel@...r.kernel.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Geert Uytterhoeven <geert.uytterhoeven@...il.com>
Subject: One comment on the __release_region in kernel/resource.c

I'd like to resend this message, since my previous letter contains html format.

Dear experts,

I am viewing the source code of __release_region() in kernel/resource.c.
And I have one comment for the performance issue.

For example, we have a resource tree like this.
10-89
   20-79
       30-49
       55-59
       60-64
       65-69
   80-89
100-279

If the caller wants to release a region of [50,59], the original code will
execute four times in the for loop in the subtree of 20-79.

After changing the code below, it will execute two times instead.

By using the "git annotate", I see this code is committed by Linus as the
initial version. So don't get more information about why this code is written
in this way.

Maybe the case I thought will not happen in the real world?

Your comment is warmly welcome. :)

diff --git a/kernel/resource.c b/kernel/resource.c
index 8461aea..81525b4 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -931,7 +931,7 @@ void __release_region(struct resource *parent,
resource_size_t start,
       for (;;) {
               struct resource *res = *p;

-               if (!res)
+               if (!res || res->start > start)
                       break;
               if (res->start <= start && res->end >= end) {
                       if (!(res->flags & IORESOURCE_BUSY)) {


-- 
Wei Yang
Help You, Help Me
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists