From patchwork Tue Aug 7 16:49:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10558929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A262D14E5 for ; Tue, 7 Aug 2018 16:49:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91C442A70A for ; Tue, 7 Aug 2018 16:49:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85BE12A713; Tue, 7 Aug 2018 16:49:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C45F2A70A for ; Tue, 7 Aug 2018 16:49:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 571826B026D; Tue, 7 Aug 2018 12:49:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5229D6B026E; Tue, 7 Aug 2018 12:49:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4381C6B026F; Tue, 7 Aug 2018 12:49:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id 1CFD86B026D for ; Tue, 7 Aug 2018 12:49:16 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id w14-v6so17386566qkw.2 for ; Tue, 07 Aug 2018 09:49:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:to:from :subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=InR8UYivZt3Do63AQUtrjdguD20rxdIFWErYGtEp+YI=; b=emZSZV8u++/YdQBlwBNNwX1JrwziYlyYeaIorNJWCiPWzmZFnhclXL18QoNKKpUsX/ wSFQbbHr/yjLtYi98VMMos1cCPqMQKya+fgnp8uOY4rgSEL5nHIvm0CSYZSBctlOZdXe 7JDtnS53nXCoJ3j8Xy7k++q2aTDDM7lO4aE61Lw9pQJChsHiOITB/G92wNovZrz4G4/r 0tfaunDJLEGEWxiNJeIEWVMY3y/p+021rgfyE+9+7XBkeUhQeDHdPdCK9QmP9wlMCcLJ NiWzisoxtgsLJrFCfkqzvBFfuXgiiJgGPBuMY40Q645C+XbB74GiVCCBnVqeVZYLjJd4 3xHA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" X-Gm-Message-State: AOUpUlEoxcXyIFd8NakRF7bVIrSgAIQ6u1kZFPuJGPXFikQI9cLg/tMB yC438z7fuMV4jYG0MntvF+l1/KuAsW7sOrDdgaIlG29L37svLOikYf8EG49vGhYoaK9GliRXrZB mT62ftzmBxWyzVR47C4YOlXpFZKaRwOYhlzByvCY9tnMzRmCpJEM43oNQD+g7sRzRUg== X-Received: by 2002:a37:4150:: with SMTP id o77-v6mr17948223qka.78.1533660555893; Tue, 07 Aug 2018 09:49:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeMx7PMz6pRgr35lOyXpP3Vaz78y9eSKATuVKgdz8qNMPIzzAEUJLPNi79ve5TZ1rB1QSks X-Received: by 2002:a37:4150:: with SMTP id o77-v6mr17948189qka.78.1533660555283; Tue, 07 Aug 2018 09:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533660555; cv=none; d=google.com; s=arc-20160816; b=dCzdJiJV23mWDMrFgZjlDdpYhW2ssFL50nV6MlNiIRcbtVmQePITB0f7KeJwI5/BFq GS1WTOVQ5Dp53HMGqi/hqU4DZQtkz7GG+1KNhuXLSOVJZcczp2dRI+p3OMK7hOJcPwZ6 9yIkB6usPWwB3Ggk/P0RbqG9mPb+xWXeZq+MybKF3VWNHrHMU6hCfJNybBwev1hEdh7d CpuVA7Zcbhu1nYJB6j83uoMhMdmxV81PUCx83UPw7jLEdD05vmWPAhBoitSBHZdHufaM E85Wlxtd9nH+/Vq8MhbjGAkPjLkNn0S41oxgRJkQyD2hKmnIoNdyTANk7tFvsXCWEzvl yY4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:mime-version:user-agent :date:message-id:subject:from:to:arc-authentication-results; bh=InR8UYivZt3Do63AQUtrjdguD20rxdIFWErYGtEp+YI=; b=GSrioRG1ejmiPrIx6X4xegAin2IuGp2LSjGu144+t1MUpC1h7IVFcbk8/056+me0vC DxVWk/avcxejjhyvDpltuj29iPYm7cfMN5ItKF2mlZfq1TnDbZwbek0EukE5zHjVPkfB qnEU3S8kNGA3dE+w5rogIK8phULT0PI1nM44z/YtF5q9G71aqh+agF3vI4PFsJGRFlmL y5+I5db7WqMff/WodjVcjIUJpasYMTSRz07JQyovF4xIudmqnetUpr4EAmTS0aJ29k6A PPrlzRLunVTZJxM8tfa3FHxR+IUB4GiLwNcugepoQWs6/I9UqVOIQ+i+zCqqaTpEhuGM V/2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" Received: from mail.cybernetics.com (mail.cybernetics.com. [173.71.130.66]) by mx.google.com with ESMTPS id y74-v6si1741573qkg.315.2018.08.07.09.49.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 09:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) client-ip=173.71.130.66; Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" X-ASG-Debug-ID: 1533660553-0fb3b01fb342b970001-v9ZeMO Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id cMcEferQEOTLuIkw (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Tue, 07 Aug 2018 12:49:13 -0400 (EDT) X-Barracuda-Envelope-From: tonyb@cybernetics.com X-ASG-Whitelist: Client Received: from [10.157.2.224] (account tonyb HELO [192.168.200.1]) by cybernetics.com (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 8324867; Tue, 07 Aug 2018 12:49:13 -0400 To: Matthew Wilcox , Christoph Hellwig , Marek Szyprowski , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "iommu@lists.linux-foundation.org" , "linux-mm@kvack.org" , "linux-scsi@vger.kernel.org" , "MPT-FusionLinux.pdl@broadcom.com" From: Tony Battersby Subject: [PATCH v3 08/10] dmapool: improve accuracy of debug statistics Message-ID: X-ASG-Orig-Subj: [PATCH v3 08/10] dmapool: improve accuracy of debug statistics Date: Tue, 7 Aug 2018 12:49:13 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1533660553 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1709 X-Virus-Scanned: by bsmtpd at cybernetics.com X-Barracuda-BRTS-Status: 1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The "total number of blocks in pool" debug statistic currently does not take the boundary value into account, so it diverges from the "total number of blocks in use" statistic when a boundary is in effect. Add a calculation for the number of blocks per allocation that takes the boundary into account, and use it to replace the inaccurate calculation. Signed-off-by: Tony Battersby --- This was split off from "dmapool: reduce footprint in struct page" in v2. This depends on patch #1 "dmapool: fix boundary comparison" for the calculated blks_per_alloc value to be correct. The added blks_per_alloc value will also be used in the next patch. --- linux/mm/dmapool.c.orig 2018-08-06 17:48:54.000000000 -0400 +++ linux/mm/dmapool.c 2018-08-06 17:52:53.000000000 -0400 @@ -61,6 +61,7 @@ struct dma_pool { /* the pool */ struct device *dev; unsigned int allocation; unsigned int boundary; + unsigned int blks_per_alloc; char name[32]; struct list_head pools; }; @@ -105,8 +106,7 @@ show_pools(struct device *dev, struct de /* per-pool info, no real statistics yet */ temp = scnprintf(next, size, "%-16s %4zu %4zu %4u %2u\n", pool->name, blocks, - (size_t) pages * - (pool->allocation / pool->size), + (size_t) pages * pool->blks_per_alloc, pool->size, pages); size -= temp; next += temp; @@ -182,6 +182,9 @@ struct dma_pool *dma_pool_create(const c retval->size = size; retval->boundary = boundary; retval->allocation = allocation; + retval->blks_per_alloc = + (allocation / boundary) * (boundary / size) + + (allocation % boundary) / size; INIT_LIST_HEAD(&retval->pools);