hc
2023-11-07 f45e756958099c35d6afb746df1d40a1c6302cfc
kernel/fs/userfaultfd.c
....@@ -56,7 +56,7 @@
5656 /* waitqueue head for events */
5757 wait_queue_head_t event_wqh;
5858 /* a refile sequence protected by fault_pending_wqh lock */
59
- struct seqcount refile_seq;
59
+ seqlock_t refile_seq;
6060 /* pseudo fd refcounting */
6161 atomic_t refcount;
6262 /* userfaultfd syscall flags */
....@@ -1060,7 +1060,7 @@
10601060 * waitqueue could become empty if this is the
10611061 * only userfault.
10621062 */
1063
- write_seqcount_begin(&ctx->refile_seq);
1063
+ write_seqlock(&ctx->refile_seq);
10641064
10651065 /*
10661066 * The fault_pending_wqh.lock prevents the uwq
....@@ -1086,7 +1086,7 @@
10861086 list_del(&uwq->wq.entry);
10871087 add_wait_queue(&ctx->fault_wqh, &uwq->wq);
10881088
1089
- write_seqcount_end(&ctx->refile_seq);
1089
+ write_sequnlock(&ctx->refile_seq);
10901090
10911091 /* careful to always initialize msg if ret == 0 */
10921092 *msg = uwq->msg;
....@@ -1259,11 +1259,11 @@
12591259 * sure we've userfaults to wake.
12601260 */
12611261 do {
1262
- seq = read_seqcount_begin(&ctx->refile_seq);
1262
+ seq = read_seqbegin(&ctx->refile_seq);
12631263 need_wakeup = waitqueue_active(&ctx->fault_pending_wqh) ||
12641264 waitqueue_active(&ctx->fault_wqh);
12651265 cond_resched();
1266
- } while (read_seqcount_retry(&ctx->refile_seq, seq));
1266
+ } while (read_seqretry(&ctx->refile_seq, seq));
12671267 if (need_wakeup)
12681268 __wake_userfault(ctx, range);
12691269 }
....@@ -1941,7 +1941,7 @@
19411941 init_waitqueue_head(&ctx->fault_wqh);
19421942 init_waitqueue_head(&ctx->event_wqh);
19431943 init_waitqueue_head(&ctx->fd_wqh);
1944
- seqcount_init(&ctx->refile_seq);
1944
+ seqlock_init(&ctx->refile_seq);
19451945 }
19461946
19471947 SYSCALL_DEFINE1(userfaultfd, int, flags)