Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf jit: Remove unecessary padding in jitdump file

This patch removes all the string padding generated in the jitdump file.
They are not necessary and were adding unnecessary complexity. Modern
processors can handle unaligned accesses quite well. The perf.data/
jitdump file are always post-processed, no need to add extra complexity
for no real gain.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1476356383-30100-4-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Stephane Eranian and committed by
Arnaldo Carvalho de Melo
13b9012a 621cb4e7

+1 -37
+1 -37
tools/perf/jvmti/jvmti_agent.c
··· 44 44 static char jit_path[PATH_MAX]; 45 45 static void *marker_addr; 46 46 47 - /* 48 - * padding buffer 49 - */ 50 - static const char pad_bytes[7]; 51 - 52 47 static inline pid_t gettid(void) 53 48 { 54 49 return (pid_t)syscall(__NR_gettid); ··· 225 230 226 231 void *jvmti_open(void) 227 232 { 228 - int pad_cnt; 229 233 char dump_path[PATH_MAX]; 230 234 struct jitheader header; 231 235 int fd; ··· 282 288 header.total_size = sizeof(header); 283 289 header.pid = getpid(); 284 290 285 - /* calculate amount of padding '\0' */ 286 - pad_cnt = PADDING_8ALIGNED(header.total_size); 287 - header.total_size += pad_cnt; 288 - 289 291 header.timestamp = perf_get_timestamp(); 290 292 291 293 if (use_arch_timestamp) ··· 291 301 warn("jvmti: cannot write dumpfile header"); 292 302 goto error; 293 303 } 294 - 295 - /* write padding '\0' if necessary */ 296 - if (pad_cnt && !fwrite(pad_bytes, pad_cnt, 1, fp)) { 297 - warn("jvmti: cannot write dumpfile header padding"); 298 - goto error; 299 - } 300 - 301 304 return fp; 302 305 error: 303 306 fclose(fp); ··· 332 349 static int code_generation = 1; 333 350 struct jr_code_load rec; 334 351 size_t sym_len; 335 - size_t padding_count; 336 352 FILE *fp = agent; 337 353 int ret = -1; 338 354 ··· 348 366 349 367 rec.p.id = JIT_CODE_LOAD; 350 368 rec.p.total_size = sizeof(rec) + sym_len; 351 - padding_count = PADDING_8ALIGNED(rec.p.total_size); 352 - rec.p. total_size += padding_count; 353 369 rec.p.timestamp = perf_get_timestamp(); 354 370 355 371 rec.code_size = size; ··· 373 393 ret = fwrite_unlocked(&rec, sizeof(rec), 1, fp); 374 394 fwrite_unlocked(sym, sym_len, 1, fp); 375 395 376 - if (padding_count) 377 - fwrite_unlocked(pad_bytes, padding_count, 1, fp); 378 - 379 396 if (code) 380 397 fwrite_unlocked(code, size, 1, fp); 381 398 ··· 389 412 { 390 413 struct jr_code_debug_info rec; 391 414 size_t sret, len, size, flen; 392 - size_t padding_count; 393 415 uint64_t addr; 394 416 const char *fn = file; 395 417 FILE *fp = agent; ··· 419 443 * int : line number 420 444 * int : column discriminator 421 445 * file[] : source file name 422 - * padding : pad to multiple of 8 bytes 423 446 */ 424 447 size += nr_lines * sizeof(struct debug_entry); 425 448 size += flen * nr_lines; 426 - /* 427 - * pad to 8 bytes 428 - */ 429 - padding_count = PADDING_8ALIGNED(size); 430 - 431 - rec.p.total_size = size + padding_count; 449 + rec.p.total_size = size; 432 450 433 451 /* 434 452 * If JVM is multi-threaded, nultiple concurrent calls to agent ··· 456 486 if (sret != 1) 457 487 goto error; 458 488 } 459 - if (padding_count) { 460 - sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp); 461 - if (sret != 1) 462 - goto error; 463 - } 464 - 465 489 funlockfile(fp); 466 490 return 0; 467 491 error: