Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp595189imm; Fri, 11 May 2018 03:28:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqt00UNfemre+Sfkt2QlR3yOJxM7ssfmIUFb5+PrVcPzOiI4WrN44FfFV45m5JIdUl4jg2X X-Received: by 2002:a63:6407:: with SMTP id y7-v6mr493512pgb.373.1526034534465; Fri, 11 May 2018 03:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526034534; cv=none; d=google.com; s=arc-20160816; b=ucrqyUU64lKxYBwtwrZXyPq3E4o9Hq2/s1jOzlBLikI+XyKu4gDiMUBqN/guBnrgSv kSmUJii0IzwLMZV/95mYFlD6gbcflE2jqaz7Ypz1HYx2fj3WSotlWbNVDcohlQ/rztPu Rj3Dptm+be7IKHsDH8jkLnILxtb1Ci/MiEVrbthwGCYwcUpouKLb48BcYN6BUu5hL/v7 2HJ8UjKJfbHhr3M/897/XkISvWqkXDVih06akRVyLMW+OFEFL1iFNRLJ27q+tfNnlymM JJt/Z0zyIMB+7OEBtMhHUc3Lk2kwz5mWbp9KZQkOpYjAqzKfbHxRwtNWxXhVCsoLeMoe Wv+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=39G3wdol4pJq2S0ohjyL2lzNPt9TyOc+zRHwC6y+r/8=; b=SiEzR0OG9NKDA4pHvLSXaGVP7yXhMfshMJsW8iATSrJbQhEokIpoYu4lxkSQki/6Au GXZkJUMCd/oCtwhV1JKuSCIfdRJA1vHUIVNXIY6ho+WBl7m0bGbvM94pEnug4w1OjsSm YApvdc5zr9CG80XjcfzNHHLRGULNuKYaMD4UKbnrod9BrSSISWhrIkSLH1HyylY0bB4i 0h3YKk1Mcb+yoGKL0maMBSGuEGZXVRMKMKeZ0G1q+M1Qv/+dE7I2UXKcktzm3BqPYili LZ+8npXmwvuW1A9D7diydaD83ywijkvyGsuf9uq+sJR1+gilgkOwZ/8e6CjRwcVztOeD PttQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=D3U9Gl7e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba9-v6si2960848plb.110.2018.05.11.03.28.40; Fri, 11 May 2018 03:28:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=D3U9Gl7e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbeEKK1Z (ORCPT + 99 others); Fri, 11 May 2018 06:27:25 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:40370 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752535AbeEKK1X (ORCPT ); Fri, 11 May 2018 06:27:23 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4BAKt9K085357; Fri, 11 May 2018 10:27:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2017-10-26; bh=39G3wdol4pJq2S0ohjyL2lzNPt9TyOc+zRHwC6y+r/8=; b=D3U9Gl7eFnuoPXuRMePYT0ju2C+N87DxgAYOGb0sJ2MmDvXQ+49OmC293lVy/nOHpv3J V8iCJ3UYYjtDIxoHPDvG5ByaFOMF8puSkjLb/4yze/L0PQrMb85gJ/5ip0JEXhGSW1Xe LbioERNFHWSvDOZA24/QNqdnO8K6aqOP+D17uQldeITDZrDBwWgrHQqcpYYB/YheZJvC 8IrOqRLmvVUjObRvVrQLLNz2Sz+iB3ikYmFq1jh9anTX3C8lhv4Mo2oxURtQZBI7GSs9 V1Cn9tFYhj87d7ZXxkY2uAS85j+L6J4SyasHXjy+4T0Jl37EF8P5HXLqZ/ULcf1Fv/8f rw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2hvth93gsb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 May 2018 10:27:16 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4BARFaT003632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 May 2018 10:27:16 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4BARF7d006666; Fri, 11 May 2018 10:27:15 GMT Received: from [10.177.45.174] (/82.214.239.4) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 11 May 2018 03:27:15 -0700 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] mlx4_core: allocate 4KB ICM chunks From: =?utf-8?Q?H=C3=A5kon_Bugge?= In-Reply-To: <20180510233143.7236-1-qing.huang@oracle.com> Date: Fri, 11 May 2018 12:27:09 +0200 Cc: tariqt@mellanox.com, davem@davemloft.net, netdev@vger.kernel.org, OFED mailing list , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <5ABF1B88-882E-4575-8E8C-41F0452FECC1@oracle.com> References: <20180510233143.7236-1-qing.huang@oracle.com> To: Qing Huang X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8889 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=9 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=875 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805110100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 11 May 2018, at 01:31, Qing Huang wrote: >=20 > When a system is under memory presure (high usage with fragments), > the original 256KB ICM chunk allocations will likely trigger kernel > memory management to enter slow path doing memory compact/migration > ops in order to complete high order memory allocations. >=20 > When that happens, user processes calling uverb APIs may get stuck > for more than 120s easily even though there are a lot of free pages > in smaller chunks available in the system. >=20 > Syslog: > ... > Dec 10 09:04:51 slcc03db02 kernel: [397078.572732] INFO: task > oracle_205573_e:205573 blocked for more than 120 seconds. > ... >=20 > With 4KB ICM chunk size, the above issue is fixed. >=20 > However in order to support 4KB ICM chunk size, we need to fix another > issue in large size kcalloc allocations. >=20 > E.g. > Setting log_num_mtt=3D30 requires 1G mtt entries. With the 4KB ICM = chunk > size, each ICM chunk can only hold 512 mtt entries (8 bytes for each = mtt > entry). So we need a 16MB allocation for a table->icm pointer array to > hold 2M pointers which can easily cause kcalloc to fail. >=20 > The solution is to use vzalloc to replace kcalloc. There is no need > for contiguous memory pages for a driver meta data structure (no need > of DMA ops). >=20 > Signed-off-by: Qing Huang > Acked-by: Daniel Jurgens > --- > drivers/net/ethernet/mellanox/mlx4/icm.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c = b/drivers/net/ethernet/mellanox/mlx4/icm.c > index a822f7a..2b17a4b 100644 > --- a/drivers/net/ethernet/mellanox/mlx4/icm.c > +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c > @@ -43,12 +43,12 @@ > #include "fw.h" >=20 > /* > - * We allocate in as big chunks as we can, up to a maximum of 256 KB > - * per chunk. > + * We allocate in 4KB page size chunks to avoid high order memory > + * allocations in fragmented/high usage memory situation. > */ > enum { > - MLX4_ICM_ALLOC_SIZE =3D 1 << 18, > - MLX4_TABLE_CHUNK_SIZE =3D 1 << 18 > + MLX4_ICM_ALLOC_SIZE =3D 1 << 12, > + MLX4_TABLE_CHUNK_SIZE =3D 1 << 12 Shouldn=E2=80=99t these be the arch=E2=80=99s page size order? E.g., if = running on SPARC, the hw page size is 8KiB. Thxs, H=C3=A5kon > }; >=20 > static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct = mlx4_icm_chunk *chunk) > @@ -400,7 +400,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, = struct mlx4_icm_table *table, > obj_per_chunk =3D MLX4_TABLE_CHUNK_SIZE / obj_size; > num_icm =3D (nobj + obj_per_chunk - 1) / obj_per_chunk; >=20 > - table->icm =3D kcalloc(num_icm, sizeof(*table->icm), = GFP_KERNEL); > + table->icm =3D vzalloc(num_icm * sizeof(*table->icm)); > if (!table->icm) > return -ENOMEM; > table->virt =3D virt; > @@ -446,7 +446,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, = struct mlx4_icm_table *table, > mlx4_free_icm(dev, table->icm[i], use_coherent); > } >=20 > - kfree(table->icm); > + vfree(table->icm); >=20 > return -ENOMEM; > } > @@ -462,5 +462,5 @@ void mlx4_cleanup_icm_table(struct mlx4_dev *dev, = struct mlx4_icm_table *table) > mlx4_free_icm(dev, table->icm[i], = table->coherent); > } >=20 > - kfree(table->icm); > + vfree(table->icm); > } > --=20 > 2.9.3 >=20 > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" = in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html