Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1578856ybg; Wed, 29 Jul 2020 19:01:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqefByvYP4EQKVxo8C2e9KAx8gN5S0yWK+RgKHz+PVpgvg8IkNwv9Tm2/+bfC2MEHkfPfV X-Received: by 2002:a17:906:7709:: with SMTP id q9mr412598ejm.123.1596074468325; Wed, 29 Jul 2020 19:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596074468; cv=none; d=google.com; s=arc-20160816; b=ELmnADjK4nM+qDKnQ9PJcIa1cCw39DfpQmBRUzQ2ONQGDrWGuu+wl5j0TaDTu33n/1 YcMx/LuPFq9lEuAYe4uuZo6wrWeAcF62K0oB6tAe8gB6QE2t/jOQWdM2qGslHeqzpsI/ v8uWbnJuTYaeKVDwa59A4j9vTB8bh1FLqmoOISQ1AFXygP8GfpapA0G069xS2ew/Yy33 omEPeMuTRsD5qR0+b++I8z+m+6O/3zKIVPpuGPkKJtPPCdHwDvEEgzTkapCbBq7SaArj I0dtVrkp8Wrc3YVbdPKqQ3kXJUUHDObQZ2FU8C/yLHvOyt5dZXwmiWOf3Dlw4r6/EcN7 zyoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=hD4JVbRoXU8HBHOVfHiuteW8LNmG7l4+fLjJw6+lL+o=; b=XOS5QjTGQ8/fhVr/zRoZ/m9PVcNgerw/EDVwa5Liumi8lcX/NKIRHCBmlNB15vtE/u ujNBD3IDZJNzeuNaVFOdx3Aq+419ML9iqIDy9/DoIxaWI8UObLNquB8HSlvfTowLLkTu G6EVSvHR/zq11wzQ2TMPCxo5e4DIDcvZvbOICabyNuA7aBuhC7hR0ytCm7gw3piyjk/a MY8P5TfWoKLB2g87yITJWYoZNQY5GIP71qYEp7wHPdjVkyhN/zzijNbUM7w/8K3JNA6T Z9XbS8eIJWS9FdhutYERbsMlnBecnzGXuTvANZHXogIYaBckECppeS1nB+a8lkYc9ugX eZXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NNHAiB3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s3si2276379edy.554.2020.07.29.19.00.45; Wed, 29 Jul 2020 19:01:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NNHAiB3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbgG3B6E (ORCPT + 99 others); Wed, 29 Jul 2020 21:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728305AbgG3B6E (ORCPT ); Wed, 29 Jul 2020 21:58:04 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5148C0619D2 for ; Wed, 29 Jul 2020 18:58:03 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id p15so4013967qvv.7 for ; Wed, 29 Jul 2020 18:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=hD4JVbRoXU8HBHOVfHiuteW8LNmG7l4+fLjJw6+lL+o=; b=NNHAiB3GjPKlQ2xd5ZEwvNI3BDPOqBsPbHib1dCO1pZMaDNmrdPoRZI+l+EGuATwEr LTtHLGmJFuTcIfU43Sqt7WooR5gHwVSc5mQM6X2YENJvLGONb7TGwcsKR2Ch+t+w9Gsh MFH0D0jjOIfYTSTEhLPQD/VhFax+cUjC/QKjVrcbzM0yZRgbYgBELsI2na6TDBicnWRB VCx8lSF2ElimO0Kpffa/BFNtv2ids+2NZ6uou8OYNhal1Ac5a+T6nCpM3/F0ySEt3NkI 5L7dt1j0BSu3dopiQ97Q+CbqhkfRadubUKfaQjHQFkUHP40w1Ve98WSC53EtzifkMmNb xH7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=hD4JVbRoXU8HBHOVfHiuteW8LNmG7l4+fLjJw6+lL+o=; b=QOPDS2NPyOs9IZY7ggyxHdzlwlROrK55cT1XEH9XkegBgAZ6StkxfZJFaNLM2Ddru9 OHH3U2P93HxbegflzT6hwbne+NLmJZGhbFCnyCQvuBR4u9l3tMMsSkGqev0a7PwW3n7U apeu/E0BN6Ly4YjW3B8rIQKu6W7fmuW8oBGjU3xLhwLtyEjYwdpUaFNiU671Curqzy8Y Y7q3dYYKCMuqBANX3GmDxhJ6I/4zrpWmCbAaZu7P9F1QDmq7rc7S5fhNaqMPr4gX7iO3 Z1rwMDMqHiToqHCv5QhpMTssTA9HQ/NGGDwNA73PK2XhVIL5eDU6apwkhn3x1T4J8Uc7 nJGA== X-Gm-Message-State: AOAM533cQ2/vTsaJXvfD9NNp9JFR1nVUUj74igJIamTrOn5OgaL3IhqS jrHnWjQL+xTcI3N3L4490u3ec6EThWDqLQ== X-Received: by 2002:ad4:4d83:: with SMTP id cv3mr767697qvb.236.1596074282824; Wed, 29 Jul 2020 18:58:02 -0700 (PDT) Date: Wed, 29 Jul 2020 18:57:55 -0700 Message-Id: <20200730015755.1827498-1-edumazet@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.rc0.142.g3c755180ce-goog Subject: [PATCH net] RDMA/umem: add a schedule point in ib_umem_get() From: Eric Dumazet To: Doug Ledford , Jason Gunthorpe Cc: linux-kernel , Eric Dumazet , Eric Dumazet , linux-rdma@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mapping as little as 64GB can take more than 10 seconds, triggering issues on kernels with CONFIG_PREEMPT_NONE=y. ib_umem_get() already splits the work in 2MB units on x86_64, adding a cond_resched() in the long-lasting loop is enough to solve the issue. Note that sg_alloc_table() can still use more than 100 ms, which is also problematic. This might be addressed later in ib_umem_add_sg_table(), adding new blocks in sgl on demand. Signed-off-by: Eric Dumazet Cc: Doug Ledford Cc: Jason Gunthorpe Cc: linux-rdma@vger.kernel.org --- 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 82455a1392f1d19c96ae956f0bd4e93e3a52d29c..831bff8d52e547834e9e04064127fbb280595126 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -261,6 +261,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, sg = umem->sg_head.sgl; while (npages) { + cond_resched(); ret = pin_user_pages_fast(cur_base, min_t(unsigned long, npages, PAGE_SIZE / -- 2.28.0.rc0.142.g3c755180ce-goog