[PATCH] D133003: [ELF] Parallelize relocation scanning

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 10 15:31:13 PDT 2022


MaskRay added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:1566-1571
   for (Partition &part : partitions) {
     for (EhInputSection *sec : part.ehFrame->sections)
       scanner.template scanSection<ELFT>(*sec);
     if (part.armExidx && part.armExidx->isLive())
       for (InputSection *sec : part.armExidx->exidxSections)
         scanner.template scanSection<ELFT>(*sec);
----------------
andrewng wrote:
> This is running on the main thread. Is there a chance that this might clash with thread 0 of the task pool?
Thanks for catching this. The main thread doing heavy work will contend with the thread pool. Changed to use `tg.execute`.


================
Comment at: lld/ELF/Relocations.cpp:1559
+    };
+    if (serial)
+      fn();
----------------
andrewng wrote:
> MaskRay wrote:
> > andrewng wrote:
> > > I wonder if it might be worthwhile using the previous code for the serial case? Although, it probably doesn't make a big difference to performance.
> > Use which piece of code for the serial case?
> I was thinking this:
> ```
> for (InputSectionBase *sec : inputSections)
>   if (sec->isLive() && (sec->flags & SHF_ALLOC))
>     scanner.template scanSection<ELFT>(*sec);
> ```
> But on the other hand, in terms of future development and maintenance, it's probably better to use as much of the same code for both "paths", even if there's a minor performance penalty for the serial one.
Yes, using the same code for both paths is better for maintenance.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133003/new/

https://reviews.llvm.org/D133003



More information about the llvm-commits mailing list