浏览代码

oprofile: simplify sync_buffer()

Make code more readable. No functional changes.

Signed-off-by: Robert Richter <robert.richter@amd.com>
Robert Richter 16 年之前
父节点
当前提交
317f33bce6
共有 1 个文件被更改,包括 14 次插入6 次删除
  1. 14 6
      drivers/oprofile/buffer_sync.c

+ 14 - 6
drivers/oprofile/buffer_sync.c

@@ -579,12 +579,20 @@ void sync_buffer(int cpu)
 				add_user_ctx_switch(new, cookie);
 				break;
 			}
-		} else if (state >= sb_bt_start &&
-			   !add_sample(mm, s, in_kernel)) {
-			if (state == sb_bt_start) {
-				state = sb_bt_ignore;
-				atomic_inc(&oprofile_stats.bt_lost_no_mapping);
-			}
+			continue;
+		}
+
+		if (state < sb_bt_start)
+			/* ignore sample */
+			continue;
+
+		if (add_sample(mm, s, in_kernel))
+			continue;
+
+		/* ignore backtraces if failed to add a sample */
+		if (state == sb_bt_start) {
+			state = sb_bt_ignore;
+			atomic_inc(&oprofile_stats.bt_lost_no_mapping);
 		}
 	}
 	release_mm(mm);