[tracker-miners/wip/carlosg/sched-setattr-mishaps: 2/3] tracker-miner-fs: 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/sched-setattr-mishaps: 2/3] tracker-miner-fs: Set cpu/io/nice settings before glib/gio usage
- Date: Wed, 19 Feb 2020 17:33:33 +0000 (UTC)
commit d9753299a0f384c377066b985d6dcabe7699888e
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 19 18:27:21 2020 +0100
tracker-miner-fs: 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/miners/fs/tracker-main.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 03e8e6496..7ae85e254 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -271,14 +271,10 @@ initialize_signal_handler (void)
}
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 ();
@@ -823,6 +819,9 @@ main (gint argc, gchar *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",
@@ -851,10 +850,6 @@ main (gint argc, gchar *argv[])
sanity_check_option_values (config);
- /* This makes sure we don't steal all the system's resources */
- initialize_priority_and_scheduling (tracker_config_get_sched_idle (config),
- tracker_miner_files_get_first_index_done () == FALSE);
-
main_loop = g_main_loop_new (NULL, FALSE);
if (domain_ontology_name) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]