All of lore.kernel.org
 help / color / mirror / Atom feed
* [GSoC] How to protect cached_objects
@ 2019-05-23 16:51 Matheus Tavares Bernardino
  2019-05-24  6:13 ` Jeff King
  2019-05-24  9:55 ` Duy Nguyen
  0 siblings, 2 replies; 6+ messages in thread
From: Matheus Tavares Bernardino @ 2019-05-23 16:51 UTC (permalink / raw)
  To: git
  Cc: Christian Couder, Nguyễn Thái Ngọc Duy,
	Оля
	Тележная

Hi, everyone

As one of my first tasks in GSoC, I'm looking to protect the global
states at sha1-file.c for future parallelizations. Currently, I'm
analyzing how to deal with the cached_objects array, which is a small
set of in-memory objects that read_object_file() is able to return
although they don't really exist on disk. The only current user of
this set is git-blame, which adds a fake commit containing
non-committed changes.

As it is now, if we start parallelizing blame, cached_objects won't be
a problem since it is written to only once, at the beginning, and read
from a couple times latter, with no possible race conditions.

But should we make these operations thread safe for future uses that
could involve potential parallel writes and reads too?

If so, we have two options:
- Make the array thread local, which would oblige us to replicate data, or
- Protect it with locks, which could impact the sequential
performance. We could have a macro here, to skip looking on
single-threaded use cases. But we don't know, a priori, the number of
threads that would want to use the pack access code.

Any thought on this?

Thanks,
Matheus Tavares

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

end of thread, other threads:[~2019-05-26  2:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 16:51 [GSoC] How to protect cached_objects Matheus Tavares Bernardino
2019-05-24  6:13 ` Jeff King
2019-05-25 14:42   ` Matheus Tavares Bernardino
2019-05-24  9:55 ` Duy Nguyen
2019-05-25 16:04   ` Matheus Tavares Bernardino
2019-05-26  2:43     ` Duy Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.