[tracker-miners/wip/carlosg/parallel-installable: 2/36] tracker-extract: Set cpu/io/nice settings before glib/gio usage
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/parallel-installable: 2/36] tracker-extract: Set cpu/io/nice settings before glib/gio usage
- Date: Sat, 14 Mar 2020 21:53:59 +0000 (UTC)
commit 9c95af06ea75d8cc14338adfefc182697065a18c
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 19 18:27:11 2020 +0100
tracker-extract: Set cpu/io/nice settings before glib/gio usage
This was happening late enough during main() that there were already
non-exclusive threadpools/threads created with regular scheduler
settings. Those settings would be cached in recent glib, creating
disparities that it will g_error() out on later. Those created threads
might however be reused later on by different code (eg. metadata
extraction, directly or indirectly), with the regular scheduling
priorities set.
Given that even accessing GSettings will result in threads being
spawned underneath, there's no better choice than doing this always.
This means the 'sched-idle' setting is ineffective. But this default
should avoid fingers from pointing at us.
src/tracker-extract/tracker-main.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index f97223a1c..849284dfe 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -109,14 +109,10 @@ static GOptionEntry entries[] = {
};
static void
-initialize_priority_and_scheduling (TrackerSchedIdle sched_idle,
- gboolean first_time_index)
+initialize_priority_and_scheduling (void)
{
/* Set CPU priority */
- if (sched_idle == TRACKER_SCHED_IDLE_ALWAYS ||
- (sched_idle == TRACKER_SCHED_IDLE_FIRST_INDEX && first_time_index)) {
- tracker_sched_idle ();
- }
+ tracker_sched_idle ();
/* Set disk IO priority and scheduling */
tracker_ioprio_init ();
@@ -229,6 +225,9 @@ run_standalone (TrackerConfig *config)
output_format_name = "turtle";
}
+ /* This makes sure we don't steal all the system's resources */
+ initialize_priority_and_scheduling ();
+
/* Look up the output format by name */
enum_class = g_type_class_ref (TRACKER_TYPE_SERIALIZATION_FORMAT);
enum_value = g_enum_get_value_by_nick (enum_class, output_format_name);
@@ -241,9 +240,6 @@ run_standalone (TrackerConfig *config)
tracker_locale_sanity_check ();
- /* This makes sure we don't steal all the system's resources */
- initialize_priority_and_scheduling (tracker_config_get_sched_idle (config), TRUE);
-
file = g_file_new_for_commandline_arg (filename);
uri = g_file_get_uri (file);
@@ -369,6 +365,9 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
+ /* This makes sure we don't steal all the system's resources */
+ initialize_priority_and_scheduling ();
+
connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
if (error) {
g_critical ("Could not create DBus connection: %s\n",
@@ -400,9 +399,6 @@ main (int argc, char *argv[])
/* Initialize subsystems */
initialize_directories ();
- /* This makes sure we don't steal all the system's resources */
- initialize_priority_and_scheduling (tracker_config_get_sched_idle (config), TRUE);
-
extract = tracker_extract_new (TRUE, force_module);
if (!extract) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]