mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 0/1]pat: remove redundant condition check
@ 2008-10-12 13:45 bibo mao
  2008-10-13 18:49 ` Pallipadi, Venkatesh
  0 siblings, 1 reply; 2+ messages in thread
From: bibo mao @ 2008-10-12 13:45 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

On file pat.c, if (start <= entry->start), it also means (start <
entry->end). This patch removes
redundant condition check.

Signed-off-by: bibo.mao@gmail.com
thanks
bibo,mao

------------------------------------------------------
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 2a50e0f..12cac5e 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -305,27 +305,6 @@ int reserve_memtype(u64 start, u64 end, unsigned
long req_type,
 							struct memtype, nd);
 			}
 			break;
-		} else if (start < entry->end) { /* start > entry->start */
-			err = chk_conflict(new, entry, new_type);
-			if (!err) {
-				dprintk("Overlap at 0x%Lx-0x%Lx\n",
-					entry->start, entry->end);
-				cached_entry = list_entry(entry->nd.prev,
-							struct memtype, nd);
-
-				/*
-				 * Move to right position in the linked
-				 * list to add this new entry
-				 */
-				list_for_each_entry_continue(entry,
-							&memtype_list, nd) {
-					if (start <= entry->start) {
-						where = entry->nd.prev;
-						break;
-					}
-				}
-			}
-			break;
 		}
 	}

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

* RE: [patch 0/1]pat: remove redundant condition check
  2008-10-12 13:45 [patch 0/1]pat: remove redundant condition check bibo mao
@ 2008-10-13 18:49 ` Pallipadi, Venkatesh
  0 siblings, 0 replies; 2+ messages in thread
From: Pallipadi, Venkatesh @ 2008-10-13 18:49 UTC (permalink / raw)
  To: bibo mao, akpm; +Cc: linux-kernel, Ingo Molnar



>-----Original Message-----
>From: linux-kernel-owner@vger.kernel.org
>[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of bibo mao
>Sent: Sunday, October 12, 2008 6:45 AM
>To: akpm@linux-foundation.org
>Cc: linux-kernel@vger.kernel.org
>Subject: [patch 0/1]pat: remove redundant condition check
>
>On file pat.c, if (start <= entry->start), it also means (start <
>entry->end). This patch removes
>redundant condition check.
>

No No.

start <= entry->start does mean start < entry->end
but
start <= entry->end does NOT mean start < entry->start

This 'else if' is to catch the cases where start < entry->end
and start > entry->start. Removing it will break the whole
logic of this function.

Thanks,
Venki

>Signed-off-by: bibo.mao@gmail.com
>thanks
>bibo,mao
>
>------------------------------------------------------
>diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
>index 2a50e0f..12cac5e 100644
>--- a/arch/x86/mm/pat.c
>+++ b/arch/x86/mm/pat.c
>@@ -305,27 +305,6 @@ int reserve_memtype(u64 start, u64 end, unsigned
>long req_type,
>                                                        struct
>memtype, nd);
>                        }
>                        break;
>-               } else if (start < entry->end) { /* start >
>entry->start */
>-                       err = chk_conflict(new, entry, new_type);
>-                       if (!err) {
>-                               dprintk("Overlap at 0x%Lx-0x%Lx\n",
>-                                       entry->start, entry->end);
>-                               cached_entry =
>list_entry(entry->nd.prev,
>-                                                       struct
>memtype, nd);
>-
>-                               /*
>-                                * Move to right position in the linked
>-                                * list to add this new entry
>-                                */
>-                               list_for_each_entry_continue(entry,
>-
>&memtype_list, nd) {
>-                                       if (start <= entry->start) {
>-                                               where = entry->nd.prev;
>-                                               break;
>-                                       }
>-                               }
>-                       }
>-                       break;
>                }
>        }
>--
>To unsubscribe from this list: send the line "unsubscribe
>linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>

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

end of thread, other threads:[~2008-10-13 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-12 13:45 [patch 0/1]pat: remove redundant condition check bibo mao
2008-10-13 18:49 ` Pallipadi, Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®