All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Junxian Huang <huangjunxian6@hisilicon.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: RE: [外部邮件] Re: [PATCH] RDMA/core: Prevent soft lockup during large user memory region cleanup
Date: Thu, 13 Nov 2025 07:38:36 +0000	[thread overview]
Message-ID: <17f0ed8403a2456da5377aaf2ec4de94@baidu.com> (raw)
In-Reply-To: <dab01bc8-d07a-0ba5-405c-1acf14dbe401@hisilicon.com>


> On 2025/11/11 15:01, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > When a process exits with numerous large, pinned memory regions
> > consisting of 4KB pages, the cleanup of the memory region through
> > __ib_umem_release() may cause soft lockups. This is because
> > unpin_user_page_range_dirty_lock()
> > is called in a tight loop for unpin and releasing page without
> > yielding the CPU.
> >
> > Fix the soft lockup by adding cond_resched() calls in
> > __ib_umem_release
> >
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  drivers/infiniband/core/umem.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/infiniband/core/umem.c
> > b/drivers/infiniband/core/umem.c index c5b6863..70c1520 100644
> > --- a/drivers/infiniband/core/umem.c
> > +++ b/drivers/infiniband/core/umem.c
> > @@ -59,6 +59,7 @@ static void __ib_umem_release(struct ib_device *dev,
> struct ib_umem *umem, int d
> >  		unpin_user_page_range_dirty_lock(sg_page(sg),
> >  			DIV_ROUND_UP(sg->length, PAGE_SIZE), make_dirty);
> >
> > +	cond_resched();
> 
> If the soft lockup is caused by unpin_user_page_range_dirty_lock(),
> cond_resched() should probably be inside the for_each_sgtable_sg loop.
> 

Ok, it is more reasonable to move it inside the loop, and calling cond_resched per 2M should have little performance impact, and don't need to limit the calling speed.

Thanks

-Li


> Junxian
> 
> >  	sg_free_append_table(&umem->sgt_append);
> >  }
> >

  reply	other threads:[~2025-11-13  7:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11  7:01 [PATCH] RDMA/core: Prevent soft lockup during large user memory region cleanup lirongqing
2025-11-11  8:19 ` Junxian Huang
2025-11-13  7:38   ` Li,Rongqing [this message]
2025-11-11 12:01 ` Leon Romanovsky
2025-11-11 12:09   ` [????] " Li,Rongqing
2025-11-12 14:19     ` Leon Romanovsky
2025-11-13  7:25       ` [????] " Li,Rongqing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17f0ed8403a2456da5377aaf2ec4de94@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.