Received: by 10.223.176.5 with SMTP id f5csp2599253wra; Mon, 29 Jan 2018 00:31:33 -0800 (PST) X-Google-Smtp-Source: AH8x225Us3sM8/8elfXQ+ZOoyBWYCo5ROkTZ5UbsSJOMujuTmDSVrLtoEIKxDCextQH6V5DqbkkS X-Received: by 10.99.63.201 with SMTP id m192mr19969526pga.358.1517214693184; Mon, 29 Jan 2018 00:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517214693; cv=none; d=google.com; s=arc-20160816; b=LkHMgtM4aA8bWbEVXYKGrZfO7JMqvNILAcuO3y7tDMHHTwNWH6hOwOee4LJFHJXWbq 33NkcYDMWkU65ucN220lK5Ws+ui8la6fjVSlCvKxcZDzym4aQdLy+ivdY0CMGbb2wXlA 0Xjz6RFe7j4tBr4dT/gr5/xPOrAHVICIYh6l7IMfLoyPogQ6rlmrg8GvxjPGtH8Xd9im 1ZtN3ewtvUcbWQZKtnJcXpvFtKoqsTQLbSW+RlSrnEExo75bFFuJIVtl/3JtO/NEMPNB hXNxgfG1JoixjEdxG27gdxSfNmYQ99nxy1PYlnXyNiihBrr659Vplwb5DqvZ4C0DpDkE 147A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=r1e6tZKBl//6zdRh3/z3SXktN/jbdFghS/U6KI6ibcs=; b=HIqk4WbqIryU077EwmsXPKIhAdq85lAl3DG2LP4+LZIkrKUzzq02dNys5oIikoHMbP 1OV9+tlSd9IeYgoTvqsS00Ph8FGYRGGwiyL4IeqYfIVkkzhUwXZsTilAqP9pwxTq40XS 7+2+mkUl0fCqON6PLfIYJ0nYdrwPrMtxthAmLTuw17kqqAmFeTo48fi5ipPVwRcijZqO F65gxA50Syk1+eyLo8WNfT6KoDoM/u2vdpwvSdwz6l2cfoJepwh+nAzqZ4KC/I9f0nKQ piSV5NeXjEiEfBQszIeDEs6pCHi4yDv9nbYF2+Bif038nyHNJc6O1EgjCrmKrUq9l/DI a6ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=SAN93NVD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b184si11339387pfg.179.2018.01.29.00.31.18; Mon, 29 Jan 2018 00:31:33 -0800 (PST) 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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=SAN93NVD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbeA2I3x (ORCPT + 99 others); Mon, 29 Jan 2018 03:29:53 -0500 Received: from mail-sn1nam01on0080.outbound.protection.outlook.com ([104.47.32.80]:5664 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751127AbeA2I3v (ORCPT ); Mon, 29 Jan 2018 03:29:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=r1e6tZKBl//6zdRh3/z3SXktN/jbdFghS/U6KI6ibcs=; b=SAN93NVDboy0u0zoczB5TGPi25A+CDjXoCQ89QiZv0tg4quKlBEVbAx51h/XRPlMYYmxiWYiWufqAyv8jPVnuoeeqkWZ7JY7V6hjq+69lHOaKa4kOE5BbfHdyFEC5ZreOWvEGeK9hl4fOwC7dWCCinVTeuNMUZHWi8STrOfJ+xY= Received: from DM3PR12CA0090.namprd12.prod.outlook.com (10.161.151.162) by BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 08:29:49 +0000 Received: from BY2NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by DM3PR12CA0090.outlook.office365.com (2603:10b6:0:57::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Mon, 29 Jan 2018 08:29:49 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT007.mail.protection.outlook.com (10.152.84.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.444.13 via Frontend Transport; Mon, 29 Jan 2018 08:29:48 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Mon, 29 Jan 2018 02:29:47 -0600 From: Roger He To: CC: , , , Roger He Subject: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Date: Mon, 29 Jan 2018 16:29:42 +0800 Message-ID: <1517214582-30880-1-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(39380400002)(376002)(2980300002)(428003)(189003)(199004)(16586007)(8936002)(478600001)(72206003)(53416004)(4326008)(104016004)(2906002)(26005)(50226002)(5660300001)(51416003)(68736007)(53936002)(7696005)(36756003)(106466001)(59450400001)(2351001)(47776003)(6666003)(336011)(305945005)(54906003)(316002)(97736004)(81166006)(81156014)(50466002)(48376002)(8676002)(77096007)(186003)(356003)(6916009)(86362001)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1442;H:SATLEXCHOV01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM03FT007;1:0rapAhXlXZTL14xATB8/g5NjIfm4VhGiJQQAtp+6YhA/zpZLAam50IPqDXtCayT98dF0rablgHIS8yi4AhpPI/29HcsP0VAbbI3hssP7g3hIopZIAWlLVA7Zc93mqGWd X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11f398fc-9b2d-4218-dbd0-08d566f275d6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1442;3:iGLrlZH6TA3FAwgHBnNs0/CjHjHvTAyd6Dw9k3nKkhe+SFDXCQMJlTDjUVFVzZGaQpO/eD0wA7v/kE7E8+lEoFazmK/OH+4IXOJIE56Bg8QGNCRF8rFS/w6Zu/z4M+wi3C2US8JGZQgcchIvNRlYSAwfFY9I4mijeQszW1TVLIygrwbEmBWSrLVD5JVPdfBFu4QtBFfxjTynm/AfEWrPxFgrg7qLSUFUbis3PW/qjbPsAi5nyiiY9Tbjay6Q0TNI5FKDeuZSQM6KNwc0dbLDvaaYvHgBnPoX8ekuIzbNW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GKOfqCDp67w/Y0pKhMt8YsA233UkHm8sVpgU4SJjaPeBqznnEw3esY50k2Ilqf5h02EReVovXl5ThEhigLQndG/SMqI4oDfS/5YumofkXNjpH0mbKnJqb61Kqpm1lqoiuqTU7iBSJsdhKQ+fToIJyEl0XpjjAH8nNLKo2WyNWF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93003095)(10201501046)(3002001)(3231101)(944501161)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BN6PR12MB1442;BCL:0;PCL:0;RULEID:;SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1442;4:ZaW1vhKRaD3kcrz3F5n3+ronte9xua8zvnmGVgQLIWXdyipF88Fi0Pb8xeAl5Q4lc9HfMH0hwCIRVhvrLrOJ5B3UeScMzkobQZCEGxSXoVVgvnVviJDvs5EuX+61wE3TCJwejC0UympR8SgMKm9iedy4drdYY0uH4mzo4bBrml8+efog7o6K5zlWw58l4Vl+6o3NOml7ZW0pvjeGh1SBHb5aZhrkiVHOWR+dda+og92f4HizUP1b2ODas6iDhGII/M4FDj2VbQh3LRwdUtH2A1TZ1g/oe8VE1iJqiAm6uwGMFj/gWW4l6bbKm10o8kjk X-Forefront-PRVS: 0567A15835 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR12MB1442;23:zxNvBDn9OPNxNVCWNy7g3pget8W10SlRcwO65xLuA?= =?us-ascii?Q?FgGR9Mi8OBaO38BKS5lsDbLT5vh+EyJJOxd8xa5VaqNfIB2LeYrGWcr6O/jW?= =?us-ascii?Q?75sLI+571wTdeE1lqUo2iAYVJYahz4j179X6Pr5tDN2gXCWKEYpM0W8WpqtO?= =?us-ascii?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MB1442;20:6zJ75l1hGVnChhpkPKFpgKrZkssYjL7lh2d/mSxydD25ePPZQEnIDuGURaaJ7cZovmpVqvGa5waRjrGfHc/wGHH846ljR3mr9/DUkjD8MxCjYx/bSYSz8zL5lfNUIwZQi9M/4iX8kmLPV/cmAfutpFs4cs34ERHgyNh85ilHLk7SJf2S7wOdVeyVV3tM/wRCkqwh7rhKqPFk/1hY15R0vChxQ64dme09NJi5lcw5cR+WSh06wdcTL4gV747v4/gY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 08:29:48.6364 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11f398fc-9b2d-4218-dbd0-08d566f275d6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ttm module needs it to determine its internal parameter setting. Signed-off-by: Roger He --- include/linux/swap.h | 6 ++++++ mm/swapfile.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index c2b8128..708d66f 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -484,6 +484,7 @@ extern int try_to_free_swap(struct page *); struct backing_dev_info; extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); extern void exit_swap_address_space(unsigned int type); +extern long get_total_swap_pages(void); #else /* CONFIG_SWAP */ @@ -516,6 +517,11 @@ static inline void show_swap_cache_info(void) { } +long get_total_swap_pages(void) +{ + return 0; +} + #define free_swap_and_cache(e) ({(is_migration_entry(e) || is_device_private_entry(e));}) #define swapcache_prepare(e) ({(is_migration_entry(e) || is_device_private_entry(e));}) diff --git a/mm/swapfile.c b/mm/swapfile.c index 3074b02..a0062eb 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -98,6 +98,21 @@ static atomic_t proc_poll_event = ATOMIC_INIT(0); atomic_t nr_rotate_swap = ATOMIC_INIT(0); +/* + * expose this value for others use + */ +long get_total_swap_pages(void) +{ + long ret; + + spin_lock(&swap_lock); + ret = total_swap_pages; + spin_unlock(&swap_lock); + + return ret; +} +EXPORT_SYMBOL_GPL(get_total_swap_pages); + static inline unsigned char swap_count(unsigned char ent) { return ent & ~SWAP_HAS_CACHE; /* may include SWAP_HAS_CONT flag */ -- 2.7.4