Skip to content

Commit

Permalink
CrOS: resourced should re-post to the correct sequence
Browse files Browse the repository at this point in the history
When resourced is not up yet we reschedule our set memory
margins dbus message to 30 seconds later. We're currently
scheduling this on the base threadpool which is incorrect,
we need to post it back to the proper sequence.

(cherry picked from commit 29b6bb5)

Bug: b/230023889
Change-Id: I7cc4b5db81c81c99452dd1b49616f2e0938d026d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3601930
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Brian Geffon <bgeffon@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#995724}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3606475
Auto-Submit: Brian Geffon <bgeffon@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5005@{#172}
Cr-Branched-From: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
bgaff authored and Chromium LUCI CQ committed Apr 26, 2022
1 parent f8c3863 commit e75c49b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions chromeos/dbus/resourced/resourced_client.cc
Expand Up @@ -10,6 +10,7 @@
#include "base/process/process_metrics.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/time/time.h"
#include "chromeos/dbus/resourced/fake_resourced_client.h"
#include "dbus/bus.h"
Expand Down Expand Up @@ -246,8 +247,8 @@ void ResourcedClientImpl::HandleSetMemoryMarginBps(
// If Chrome startup was racing with resourced startup it's possible
// that the message was not delivered because resourced was not up yet.
// Let's redispatch the message in 30 seconds.
base::ThreadPool::PostDelayedTask(
FROM_HERE, {base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::SequencedTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&ResourcedClientImpl::SetMemoryMarginsBps,
weak_factory_.GetWeakPtr(), critical_margin,
moderate_margin, std::move(callback)),
Expand Down

0 comments on commit e75c49b

Please sign in to comment.