Parcourir la source

[LibOS] Add macros for disabling semaphore and message queue migration.

Chia-Che Tsai il y a 5 ans
Parent
commit
7d6cd80027

+ 4 - 0
LibOS/shim/include/shim_defs.h

@@ -33,4 +33,8 @@
 
 #define DEFAULT_VMA_COUNT           64
 
+/* System V IPC semaphore / message queue migration */
+#define MIGRATE_SYSV_SEM            0
+#define MIGRATE_SYSV_MSG            1
+
 #endif /* _SHIM_DEFS_H_ */

+ 8 - 2
LibOS/shim/src/sys/shim_msgget.c

@@ -570,6 +570,7 @@ eagain:
     return -EAGAIN;
 }
 
+#if MIGRATE_SYSV_MSG == 1
 static int msg_balance_migrate (struct shim_handle * hdl,
                                 struct sysv_client * client);
 
@@ -579,7 +580,7 @@ static struct sysv_balance_policy msg_policy  = {
         .balance_threshold  = MSG_BALANCE_THRESHOLD,
         .migrate            = &msg_balance_migrate,
     };
-
+#endif
 
 DEFINE_PROFILE_INTERVAL(add_sysv_msg, sysv_msg);
 
@@ -612,10 +613,11 @@ int add_sysv_msg (struct shim_msg_handle * msgq,
     if ((ret = __store_msg_qobjs(msgq, mtype, size, data)) < 0)
         goto out_locked;
 
+#if MIGRATE_SYSV_MSG == 1
     if (msgq->owned)
         __balance_sysv_score(&msg_policy, hdl, msgq->scores, MAX_SYSV_CLIENTS,
                              src, MSG_SND_SCORE);
-
+#endif
     DkEventSet(msgq->event);
     ret  = 0;
 out_locked:
@@ -682,6 +684,7 @@ int get_sysv_msg (struct shim_msg_handle * msgq,
         goto out_locked;
     }
 
+#if MIGRATE_SYSV_MSG == 1
     if (msgq->owned) {
         __balance_sysv_score(&msg_policy, hdl, msgq->scores, MAX_SYSV_CLIENTS,
                              src, MSG_RCV_SCORE);
@@ -695,6 +698,7 @@ int get_sysv_msg (struct shim_msg_handle * msgq,
             goto out_locked;
         }
     }
+#endif
 
     if (!msgq->owned) {
         IDTYPE msqid = msgq->msqid;
@@ -974,6 +978,7 @@ int shim_do_msgpersist (int msqid, int cmd)
     return ret;
 }
 
+#if MIGRATE_SYSV_MSG == 1
 static int msg_balance_migrate (struct shim_handle * hdl,
                                 struct sysv_client * src)
 {
@@ -1027,3 +1032,4 @@ failed:
 out:
     return ret;
 }
+#endif

+ 6 - 0
LibOS/shim/src/sys/shim_semget.c

@@ -647,6 +647,7 @@ failed:
     }
 }
 
+#if MIGRATE_SYSV_SEM == 1
 static int sem_balance_migrate (struct shim_handle * hdl,
                                 struct sysv_client * client);
 
@@ -656,6 +657,7 @@ static struct sysv_balance_policy sem_policy  = {
         .balance_threshold  = SEM_BALANCE_THRESHOLD,
         .migrate            = &sem_balance_migrate,
     };
+#endif
 
 DEFINE_PROFILE_CATAGORY(submit_sysv_sem, sysv_sem);
 DEFINE_PROFILE_INTERVAL(sem_prepare_stat, submit_sysv_sem);
@@ -726,6 +728,7 @@ int submit_sysv_sem (struct shim_sem_handle * sem, struct sembuf * sops,
         goto out_locked;
     }
 
+#if MIGRATE_SYSV_SEM == 1
     if (sem->owned) {
         __balance_sysv_score(&sem_policy, hdl, sem->scores, MAX_SYSV_CLIENTS,
                              client, score);
@@ -739,6 +742,7 @@ int submit_sysv_sem (struct shim_sem_handle * sem, struct sembuf * sops,
             goto out_locked;
         }
     }
+#endif
 
     if (!sem->owned) {
         if (client) {
@@ -870,6 +874,7 @@ out:
     return ret;
 }
 
+#if MIGRATE_SYSV_SEM == 1
 static int sem_balance_migrate (struct shim_handle * hdl,
                                 struct sysv_client * src)
 {
@@ -953,3 +958,4 @@ failed_info:
 out:
     return ret;
 }
+#endif