diff --git a/drivers/soc/qcom/mem_buf/mem-buf-msgq.c b/drivers/soc/qcom/mem_buf/mem-buf-msgq.c index bd9412a0403c..9996963ac7ac 100644 --- a/drivers/soc/qcom/mem_buf/mem-buf-msgq.c +++ b/drivers/soc/qcom/mem_buf/mem-buf-msgq.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -12,6 +12,7 @@ #include #include #include +#include #include "mem-buf-msgq.h" #include "trace-mem-buf.h" @@ -337,8 +338,10 @@ static void mem_buf_process_alloc_resp(struct mem_buf_msgq_desc *desc, void *buf struct mem_buf_msg_hdr *hdr = buf; struct mem_buf_alloc_resp *alloc_resp = buf; struct mem_buf_txn *txn; + unsigned int noreclaim_flag; mutex_lock(&desc->idr_mutex); + noreclaim_flag = memalloc_noreclaim_save(); txn = idr_find(&desc->txn_idr, hdr->txn_id); if (!txn) { pr_err("%s no txn associated with id: %d\n", __func__, hdr->txn_id); @@ -357,6 +360,7 @@ static void mem_buf_process_alloc_resp(struct mem_buf_msgq_desc *desc, void *buf txn->resp_buf); complete(&txn->txn_done); } + memalloc_noreclaim_restore(noreclaim_flag); mutex_unlock(&desc->idr_mutex); } diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index 35a1f9ec0b10..41b96e64dd25 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -28,6 +28,7 @@ #include #include #include "qti_virtio_mem.h" +#include #include @@ -2412,6 +2413,7 @@ static void virtio_mem_run_wq(struct work_struct *work) struct virtio_mem *vm = container_of(work, struct virtio_mem, wq); uint64_t diff; int rc; + unsigned int noreclaim_flag; if (unlikely(vm->in_kdump)) { dev_warn_once(&vm->vdev->dev, @@ -2425,6 +2427,8 @@ static void virtio_mem_run_wq(struct work_struct *work) return; atomic_set(&vm->wq_active, 1); + + noreclaim_flag = memalloc_noreclaim_save(); retry: rc = 0; @@ -2487,6 +2491,7 @@ retry: } atomic_set(&vm->wq_active, 0); + memalloc_noreclaim_restore(noreclaim_flag); } static enum hrtimer_restart virtio_mem_timer_expired(struct hrtimer *timer)