imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,11 +1,11 @@
 __poll_t af_alg_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   struct alg_sock *ask = alg_sk(sk);
   struct af_alg_ctx *ctx = ask->private;
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   if (!ctx->more || ctx->used) mask |= EPOLLIN | EPOLLRDNORM;
   if (af_alg_writable(sk)) mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,17 +1,17 @@
 __poll_t iucv_sock_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask = 0;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   if (sk->sk_state == IUCV_LISTEN) return iucv_accept_poll(sk);
   if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= EPOLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0);
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   if (!skb_queue_empty(&sk->sk_receive_queue) || (sk->sk_shutdown & RCV_SHUTDOWN)) mask |= EPOLLIN | EPOLLRDNORM;
   if (sk->sk_state == IUCV_CLOSED) mask |= EPOLLHUP;
   if (sk->sk_state == IUCV_DISCONN) mask |= EPOLLIN;
   if (sock_writeable(sk) && iucv_below_msglim(sk))
     mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   else
     sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,15 +1,15 @@
 static __poll_t rxrpc_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   struct rxrpc_sock *rx = rxrpc_sk(sk);
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   /* the socket is readable if there are any messages waiting on the Rx
    * queue */
   if (!list_empty(&rx->recvmsg_q)) mask |= EPOLLIN | EPOLLRDNORM;
   /* the socket is writable if there is space to add new data to the
    * socket; there is no guarantee that any particular call in progress
    * on the socket may have space in the Tx ACK window */
   if (rxrpc_writable(sk)) mask |= EPOLLOUT | EPOLLWRNORM;
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,33 +1,33 @@
 static __poll_t smc_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask = 0;
   struct smc_sock *smc;
   if (!sk) return EPOLLNVAL;
   smc = smc_sk(sock->sk);
   if ((sk->sk_state == SMC_INIT) || smc->use_fallback) {
     /* delegate to CLC child sock */
     mask = smc->clcsock->ops->poll(file, smc->clcsock, wait);
     sk->sk_err = smc->clcsock->sk->sk_err;
     if (sk->sk_err) mask |= EPOLLERR;
   } else {
-    if (sk->sk_state != SMC_CLOSED) sock_poll_wait(file, sk_sleep(sk), wait);
+    if (sk->sk_state != SMC_CLOSED) sock_poll_wait(file, wait);
     if (sk->sk_err) mask |= EPOLLERR;
     if ((sk->sk_shutdown == SHUTDOWN_MASK) || (sk->sk_state == SMC_CLOSED)) mask |= EPOLLHUP;
     if (sk->sk_state == SMC_LISTEN) {
       /* woken up by sk_data_ready in smc_listen_work() */
       mask = smc_accept_poll(sk);
     } else {
       if (atomic_read(&smc->conn.sndbuf_space) || sk->sk_shutdown & SEND_SHUTDOWN) {
         mask |= EPOLLOUT | EPOLLWRNORM;
       } else {
         sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
         set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
       }
       if (atomic_read(&smc->conn.bytes_to_rcv)) mask |= EPOLLIN | EPOLLRDNORM;
       if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
       if (sk->sk_state == SMC_APPCLOSEWAIT1) mask |= EPOLLIN;
     }
     if (smc->conn.urg_state == SMC_URG_VALID) mask |= EPOLLPRI;
   }
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,33 +1,33 @@
 static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk, *other;
   unsigned int writable;
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   /* exceptional events? */
   if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= EPOLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0);
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   /* readable? */
   if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= EPOLLIN | EPOLLRDNORM;
   /* Connection-based need to check for termination and startup */
   if (sk->sk_type == SOCK_SEQPACKET) {
     if (sk->sk_state == TCP_CLOSE) mask |= EPOLLHUP;
     /* connection hasn't started yet? */
     if (sk->sk_state == TCP_SYN_SENT) return mask;
   }
   /* No write status requested, avoid expensive OUT tests. */
   if (!(poll_requested_events(wait) & (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT))) return mask;
   writable = unix_writable(sk);
   if (writable) {
     unix_state_lock(sk);
     other = unix_peer(sk);
     if (other && unix_peer(other) != sk && unix_recvq_full(other) && unix_dgram_peer_wake_me(sk, other)) writable = 0;
     unix_state_unlock(sk);
   }
   if (writable)
     mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   else
     sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,20 +1,20 @@
 static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   /* exceptional events? */
   if (sk->sk_err) mask |= EPOLLERR;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
   /* readable? */
   if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= EPOLLIN | EPOLLRDNORM;
   /* Connection-based need to check for termination and startup */
   if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && sk->sk_state == TCP_CLOSE) mask |= EPOLLHUP;
   /*
    * we set writable also when the other side has shut down the
    * connection. This prevents stuck sockets.
    */
   if (unix_writable(sk)) mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,19 +1,19 @@
 static __poll_t caif_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask;
   struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   /* exceptional events? */
   if (sk->sk_err) mask |= EPOLLERR;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP;
   /* readable? */
   if (!skb_queue_empty(&sk->sk_receive_queue) || (sk->sk_shutdown & RCV_SHUTDOWN)) mask |= EPOLLIN | EPOLLRDNORM;
   /*
    * we set writable also when the other side has shut down the
    * connection. This prevents stuck sockets.
    */
   if (sock_writeable(sk) && tx_flow_is_on(cf_sk)) mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,17 +1,17 @@
 __poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   struct atm_vcc *vcc;
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   vcc = ATM_SD(sock);
   /* exceptional events */
   if (sk->sk_err) mask = EPOLLERR;
   if (test_bit(ATM_VF_RELEASED, &vcc->flags) || test_bit(ATM_VF_CLOSE, &vcc->flags)) mask |= EPOLLHUP;
   /* readable? */
   if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= EPOLLIN | EPOLLRDNORM;
   /* writable? */
   if (sock->state == SS_CONNECTING && test_bit(ATM_VF_WAITING, &vcc->flags)) return mask;
   if (vcc->qos.txtp.traffic_class != ATM_NONE && vcc_writable(sk)) mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,24 +1,24 @@
 __poll_t datagram_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   mask = 0;
   /* exceptional events? */
   if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= EPOLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0);
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   /* readable? */
   if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= EPOLLIN | EPOLLRDNORM;
   /* Connection-based need to check for termination and startup */
   if (connection_based(sk)) {
     if (sk->sk_state == TCP_CLOSE) mask |= EPOLLHUP;
     /* connection hasn't started yet? */
     if (sk->sk_state == TCP_SYN_SENT) return mask;
   }
   /* writable? */
   if (sock_writeable(sk))
     mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   else
     sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,18 +1,18 @@
 static __poll_t llcp_sock_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   __poll_t mask = 0;
   pr_debug("%p\n", sk);
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   if (sk->sk_state == LLCP_LISTEN) return llcp_accept_poll(sk);
   if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= EPOLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0);
   if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= EPOLLIN | EPOLLRDNORM;
   if (sk->sk_state == LLCP_CLOSED) mask |= EPOLLHUP;
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
   if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= EPOLLHUP;
   if (sock_writeable(sk) && sk->sk_state == LLCP_CONNECTED)
     mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
   else
     sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
   pr_debug("mask 0x%x\n", mask);
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,32 +1,32 @@
 __poll_t dccp_poll(struct file *file, struct socket *sock, poll_table *wait) {
   __poll_t mask;
   struct sock *sk = sock->sk;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   if (sk->sk_state == DCCP_LISTEN) return inet_csk_listen_poll(sk);
   /* Socket is not locked. We are protected from async events
      by poll logic and correct handling of state changes
      made by another threads is impossible in any case.
    */
   mask = 0;
   if (sk->sk_err) mask = EPOLLERR;
   if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED) mask |= EPOLLHUP;
   if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
   /* Connected? */
   if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) {
     if (atomic_read(&sk->sk_rmem_alloc) > 0) mask |= EPOLLIN | EPOLLRDNORM;
     if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
       if (sk_stream_is_writeable(sk)) {
         mask |= EPOLLOUT | EPOLLWRNORM;
       } else { /* send SIGIO later */
         sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
         set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
         /* Race breaker. If space is freed after
          * wspace test but before the flags are set,
          * IO signal will be lost.
          */
         if (sk_stream_is_writeable(sk)) mask |= EPOLLOUT | EPOLLWRNORM;
       }
     }
   }
   return mask;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,25 +1,25 @@
 static __poll_t tipc_poll(struct file *file, struct socket *sock, poll_table *wait) {
   struct sock *sk = sock->sk;
   struct tipc_sock *tsk = tipc_sk(sk);
   __poll_t revents = 0;
-  sock_poll_wait(file, sk_sleep(sk), wait);
+  sock_poll_wait(file, wait);
   if (sk->sk_shutdown & RCV_SHUTDOWN) revents |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
   if (sk->sk_shutdown == SHUTDOWN_MASK) revents |= EPOLLHUP;
   switch (sk->sk_state) {
   case TIPC_ESTABLISHED:
   case TIPC_CONNECTING:
     if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) revents |= EPOLLOUT;
     /* fall thru' */
   case TIPC_LISTEN:
     if (!skb_queue_empty(&sk->sk_receive_queue)) revents |= EPOLLIN | EPOLLRDNORM;
     break;
   case TIPC_OPEN:
     if (tsk->group_is_open && !tsk->cong_link_cnt) revents |= EPOLLOUT;
     if (!tipc_sk_type_connectionless(sk)) break;
     if (skb_queue_empty(&sk->sk_receive_queue)) break;
     revents |= EPOLLIN | EPOLLRDNORM;
     break;
   case TIPC_DISCONNECTING: revents = EPOLLIN | EPOLLRDNORM | EPOLLHUP; break;
   }
   return revents;
 }<sep>@@
expression file,wait,e;
@@

        sock_poll_wait(file, 
-			e,
		 wait)
--- initial
+++ final
@@ -1,38 +1,39 @@
 static void read_bulk_callback(struct urb *urb) {
+  unsigned long flags0;
   struct hso_net *odev = urb->context;
   struct net_device *net;
   int result;
   int status = urb->status;
   /* is al ok?  (Filip: Who's Al ?) */
   if (status) {
     handle_usb_error(status, __func__, odev->parent);
     return;
   }
   /* Sanity check */
   if (!odev || !test_bit(HSO_NET_RUNNING, &odev->flags)) {
     hso_dbg(0x1, "BULK IN callback but driver is not active!\n");
     return;
   }
   usb_mark_last_busy(urb->dev);
   net = odev->net;
   if (!netif_device_present(net)) {
     /* Somebody killed our network interface... */
     return;
   }
   if (odev->parent->port_spec & HSO_INFO_CRC_BUG) fix_crc_bug(urb, odev->in_endp->wMaxPacketSize);
   /* do we even have a packet? */
   if (urb->actual_length) {
     /* Handle the IP stream, add header and push it onto network
      * stack if the packet is complete. */
-    spin_lock(&odev->net_lock);
+    spin_lock_irqsave(&odev->net_lock, flags0);
     packetizeRx(odev, urb->transfer_buffer, urb->actual_length, (urb->transfer_buffer_length > urb->actual_length) ? 1 : 0);
     spin_unlock(&odev->net_lock);
   }
   /* We are done with this URB, resubmit it. Prep the USB to wait for
    * another frame. Reuse same as received. */
   usb_fill_bulk_urb(urb, odev->parent->usb, usb_rcvbulkpipe(odev->parent->usb, odev->in_endp->bEndpointAddress & 0x7F), urb->transfer_buffer, MUX_BULK_RX_BUF_SIZE, read_bulk_callback, odev);
   /* Give this to the USB subsystem so it can tell us when more data
    * arrives. */
   result = usb_submit_urb(urb, GFP_ATOMIC);
   if (result) dev_warn(&odev->parent->interface->dev, "%s failed submit mux_bulk_rx_urb %d\n", __func__, result);
 }<sep>@@
identifier r.f;
fresh identifier flags = "flags";
expression e;
@@

f(...) {
+ unsigned long flags;
   <+...
-       spin_lock(e);
+       spin_lock_irqsave(e, flags);
...+> }
--- initial
+++ final
@@ -1,54 +1,55 @@
 static void read_bulk_callback(struct urb *urb) {
+  unsigned long flags0;
   rtl8150_t *dev;
   unsigned pkt_len, res;
   struct sk_buff *skb;
   struct net_device *netdev;
   u16 rx_stat;
   int status = urb->status;
   int result;
   dev = urb->context;
   if (!dev) return;
   if (test_bit(RTL8150_UNPLUG, &dev->flags)) return;
   netdev = dev->netdev;
   if (!netif_device_present(netdev)) return;
   switch (status) {
   case 0: break;
   case -ENOENT: return; /* the urb is in unlink state */
   case -ETIME:
     if (printk_ratelimit()) dev_warn(&urb->dev->dev, "may be reset is needed?..\n");
     goto goon;
   default:
     if (printk_ratelimit()) dev_warn(&urb->dev->dev, "Rx status %d\n", status);
     goto goon;
   }
   if (!dev->rx_skb) goto resched;
   /* protect against short packets (tell me why we got some?!?) */
   if (urb->actual_length < 4) goto goon;
   res = urb->actual_length;
   rx_stat = le16_to_cpu(*(__le16 *)(urb->transfer_buffer + res - 4));
   pkt_len = res - 4;
   skb_put(dev->rx_skb, pkt_len);
   dev->rx_skb->protocol = eth_type_trans(dev->rx_skb, netdev);
   netif_rx(dev->rx_skb);
   netdev->stats.rx_packets++;
   netdev->stats.rx_bytes += pkt_len;
-  spin_lock(&dev->rx_pool_lock);
+  spin_lock_irqsave(&dev->rx_pool_lock, flags0);
   skb = pull_skb(dev);
   spin_unlock(&dev->rx_pool_lock);
   if (!skb) goto resched;
   dev->rx_skb = skb;
 goon:
   usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
   result = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
   if (result == -ENODEV)
     netif_device_detach(dev->netdev);
   else if (result) {
     set_bit(RX_URB_FAIL, &dev->flags);
     goto resched;
   } else {
     clear_bit(RX_URB_FAIL, &dev->flags);
   }
   return;
 resched:
   tasklet_schedule(&dev->tl);
 }<sep>@@
identifier r.f;
fresh identifier flags = "flags";
expression e;
@@

f(...) {
+ unsigned long flags;
   <+...
-       spin_lock(e);
+       spin_lock_irqsave(e, flags);
...+> }
--- initial
+++ final
@@ -1,8 +1,8 @@
 void kvm_arm_resume_guest(struct kvm *kvm) {
   int i;
   struct kvm_vcpu *vcpu;
   kvm_for_each_vcpu(i, vcpu, kvm) {
     vcpu->arch.pause = false;
-    swake_up(kvm_arch_vcpu_wq(vcpu));
+    swake_up_one(kvm_arch_vcpu_wq(vcpu));
   }
 }<sep>@@
expression e;
@@
-               swake_up
+               swake_up_one
			(e)
--- initial
+++ final
@@ -1,8 +1,8 @@
 static void vcpu_req_sleep(struct kvm_vcpu *vcpu) {
   struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu);
-  swait_event_interruptible(*wq, ((!vcpu->arch.power_off) && (!vcpu->arch.pause)));
+  swait_event_interruptible_exclusive(*wq, ((!vcpu->arch.power_off) && (!vcpu->arch.pause)));
   if (vcpu->arch.power_off || vcpu->arch.pause) {
     /* Awaken to handle a signal, request we sleep again later. */
     kvm_make_request(KVM_REQ_SLEEP, vcpu);
   }
 }<sep>@@
expression e1,e2;
@@
-	swait_event_interruptible
+	swait_event_interruptible_exclusive
			(e1,e2)
--- initial
+++ final
@@ -1,30 +1,30 @@
 static void async_pf_execute(struct work_struct *work) {
   struct kvm_async_pf *apf = container_of(work, struct kvm_async_pf, work);
   struct mm_struct *mm = apf->mm;
   struct kvm_vcpu *vcpu = apf->vcpu;
   unsigned long addr = apf->addr;
   gva_t gva = apf->gva;
   int locked = 1;
   might_sleep();
   /*
    * This work is run asynchromously to the task which owns
    * mm and might be done in another context, so we must
    * access remotely.
    */
   down_read(&mm->mmap_sem);
   get_user_pages_remote(NULL, mm, addr, 1, FOLL_WRITE, NULL, NULL, &locked);
   if (locked) up_read(&mm->mmap_sem);
   kvm_async_page_present_sync(vcpu, apf);
   spin_lock(&vcpu->async_pf.lock);
   list_add_tail(&apf->link, &vcpu->async_pf.done);
   apf->vcpu = NULL;
   spin_unlock(&vcpu->async_pf.lock);
   /*
    * apf may be freed by kvm_check_async_pf_completion() after
    * this point
    */
   trace_kvm_async_pf_completed(addr, gva);
-  if (swq_has_sleeper(&vcpu->wq)) swake_up(&vcpu->wq);
+  if (swq_has_sleeper(&vcpu->wq)) swake_up_one(&vcpu->wq);
   mmput(mm);
   kvm_put_kvm(vcpu->kvm);
 }<sep>@@
expression e;
@@
-               swake_up
+               swake_up_one
			(e)
--- initial
+++ final
@@ -1,14 +1,14 @@
 static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) {
   int cpu;
   struct swait_queue_head *wqp;
   wqp = kvm_arch_vcpu_wq(vcpu);
   if (swq_has_sleeper(wqp)) {
-    swake_up(wqp);
+    swake_up_one(wqp);
     ++vcpu->stat.halt_wakeup;
   }
   cpu = READ_ONCE(vcpu->arch.thread_cpu);
   if (cpu >= 0 && kvmppc_ipi_thread(cpu)) return;
   /* CPU points to the first thread of the core */
   cpu = vcpu->cpu;
   if (cpu >= 0 && cpu < nr_cpu_ids && cpu_online(cpu)) smp_send_reschedule(cpu);
 }<sep>@@
expression e;
@@
-               swake_up
+               swake_up_one
			(e)
--- initial
+++ final
@@ -1,71 +1,71 @@
 static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) {
   ktime_t cur, start_poll, start_wait;
   int do_sleep = 1;
   u64 block_ns;
   DECLARE_SWAITQUEUE(wait);
   /* Poll for pending exceptions and ceded state */
   cur = start_poll = ktime_get();
   if (vc->halt_poll_ns) {
     ktime_t stop = ktime_add_ns(start_poll, vc->halt_poll_ns);
     ++vc->runner->stat.halt_attempted_poll;
     vc->vcore_state = VCORE_POLLING;
     spin_unlock(&vc->lock);
     do {
       if (kvmppc_vcore_check_block(vc)) {
         do_sleep = 0;
         break;
       }
       cur = ktime_get();
     } while (single_task_running() && ktime_before(cur, stop));
     spin_lock(&vc->lock);
     vc->vcore_state = VCORE_INACTIVE;
     if (!do_sleep) {
       ++vc->runner->stat.halt_successful_poll;
       goto out;
     }
   }
-  prepare_to_swait(&vc->wq, &wait, TASK_INTERRUPTIBLE);
+  prepare_to_swait_exclusive(&vc->wq, &wait, TASK_INTERRUPTIBLE);
   if (kvmppc_vcore_check_block(vc)) {
     finish_swait(&vc->wq, &wait);
     do_sleep = 0;
     /* If we polled, count this as a successful poll */
     if (vc->halt_poll_ns) ++vc->runner->stat.halt_successful_poll;
     goto out;
   }
   start_wait = ktime_get();
   vc->vcore_state = VCORE_SLEEPING;
   trace_kvmppc_vcore_blocked(vc, 0);
   spin_unlock(&vc->lock);
   schedule();
   finish_swait(&vc->wq, &wait);
   spin_lock(&vc->lock);
   vc->vcore_state = VCORE_INACTIVE;
   trace_kvmppc_vcore_blocked(vc, 1);
   ++vc->runner->stat.halt_successful_wait;
   cur = ktime_get();
 out:
   block_ns = ktime_to_ns(cur) - ktime_to_ns(start_poll);
   /* Attribute wait time */
   if (do_sleep) {
     vc->runner->stat.halt_wait_ns += ktime_to_ns(cur) - ktime_to_ns(start_wait);
     /* Attribute failed poll time */
     if (vc->halt_poll_ns) vc->runner->stat.halt_poll_fail_ns += ktime_to_ns(start_wait) - ktime_to_ns(start_poll);
   } else {
     /* Attribute successful poll time */
     if (vc->halt_poll_ns) vc->runner->stat.halt_poll_success_ns += ktime_to_ns(cur) - ktime_to_ns(start_poll);
   }
   /* Adjust poll time */
   if (halt_poll_ns) {
     if (block_ns <= vc->halt_poll_ns)
       ;
     /* We slept and blocked for longer than the max halt time */
     else if (vc->halt_poll_ns && block_ns > halt_poll_ns)
       shrink_halt_poll_ns(vc);
     /* We slept and our poll time is too small */
     else if (vc->halt_poll_ns < halt_poll_ns && block_ns < halt_poll_ns)
       grow_halt_poll_ns(vc);
     if (vc->halt_poll_ns > halt_poll_ns) vc->halt_poll_ns = halt_poll_ns;
   } else
     vc->halt_poll_ns = 0;
   trace_kvmppc_vcore_wakeup(do_sleep, block_ns);
 }<sep>@@
expression e1,e2,e3;
@@
-                       prepare_to_swait
+                       prepare_to_swait_exclusive
				(e1,e2,e3)
--- initial
+++ final
@@ -1,27 +1,27 @@
 void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu) {
   /*
    * We cannot move this into the if, as the CPU might be already
    * in kvm_vcpu_block without having the waitqueue set (polling)
    */
   vcpu->valid_wakeup = true;
   /*
    * This is mostly to document, that the read in swait_active could
    * be moved before other stores, leading to subtle races.
    * All current users do not store or use an atomic like update
    */
   smp_mb__after_atomic();
   if (swait_active(&vcpu->wq)) {
     /*
      * The vcpu gave up the cpu voluntarily, mark it as a good
      * yield-candidate.
      */
     vcpu->preempted = true;
-    swake_up(&vcpu->wq);
+    swake_up_one(&vcpu->wq);
     vcpu->stat.halt_wakeup++;
   }
   /*
    * The VCPU might not be sleeping but is executing the VSIE. Let's
    * kick it, so it leaves the SIE to process the request.
    */
   kvm_s390_vsie_kick(vcpu);
 }<sep>@@
expression e;
@@
-               swake_up
+               swake_up_one
			(e)
--- initial
+++ final
@@ -1,7 +1,7 @@
 static void apf_task_wake_one(struct kvm_task_sleep_node *n) {
   hlist_del_init(&n->link);
   if (n->halted)
     smp_send_reschedule(n->cpu);
   else if (swq_has_sleeper(&n->wq))
-    swake_up(&n->wq);
+    swake_up_one(&n->wq);
 }<sep>@@
expression e;
@@
-               swake_up
+               swake_up_one
			(e)