migration: migration_thread_is_self

Define and export migration_thread_is_self to eliminate a dependency
on MigrationState.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Link: https://lore.kernel.org/r/1710179338-294359-7-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Steve Sistare 2024-03-11 10:48:53 -07:00 committed by Peter Xu
parent 714f33123b
commit 6e78563976
3 changed files with 9 additions and 4 deletions

View file

@ -25,7 +25,6 @@
#include "sysemu/kvm.h"
#include "trace.h"
#include "migration/misc.h"
#include "migration/migration.h"
/*
* Dirtylimit stop working if dirty page rate error
@ -448,10 +447,8 @@ static void dirtylimit_cleanup(void)
*/
static bool dirtylimit_is_allowed(void)
{
MigrationState *ms = migrate_get_current();
if (migration_is_running() &&
(!qemu_thread_is_self(&ms->thread)) &&
!migration_thread_is_self() &&
migrate_dirty_limit() &&
dirtylimit_in_service()) {
return false;