From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933171AbbLWJhL (ORCPT ); Wed, 23 Dec 2015 04:37:11 -0500 Received: from mail-db3on0139.outbound.protection.outlook.com ([157.55.234.139]:23872 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754190AbbLWJhF convert rfc822-to-8bit (ORCPT ); Wed, 23 Dec 2015 04:37:05 -0500 X-Greylist: delayed 1079 seconds by postgrey-1.27 at vger.kernel.org; Wed, 23 Dec 2015 04:37:05 EST From: "Dighe, Niranjan (N.)" To: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Dmitry Eremin , James Simmons , Mike Rapoport , "Patrick Boettcher" , Matthew Tyler CC: "lustre-devel@lists.lustre.org" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] [PATCH] staging: lustre: Remove unused memhog functionality Thread-Topic: [PATCH] [PATCH] staging: lustre: Remove unused memhog functionality Thread-Index: AQHRPWDTpCOJD2of9U29g4c1VYhelp7YUCyA Date: Wed, 23 Dec 2015 09:37:01 +0000 Message-ID: <20151223093657.GA11067@siberianhusky> References: <20151223090329.GA10959@siberianhusky> In-Reply-To: <20151223090329.GA10959@siberianhusky> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ndighe@visteon.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [202.0.77.197] x-microsoft-exchange-diagnostics: 1;VI1PR06MB1053;5:UhOR+/NS6xa0kHUTmW5RLAjW5lp8p9RQo/QSGafh6Sz0xc1LGiacp3xxyGS19IMywbhqJa1fSperqfS14ybZWfFd9PEJ7UGZQVuqHhJYkmwrYe7Zea5U9K+C6hY3oXM9EBQGDJol/nF+YQyTXHuSBA==;24:TjqkbkrYP1Awz2T+nm3V9hp9dJyCyksmzzSi1UjEFVP1HcnDPrGpKkMh2ThvAwpVlXq2p/VNGTCG8mxyFQdiOD4x3khM1saPEmlnVO8gMEw= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR06MB1053; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(208512329853888); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:VI1PR06MB1053;BCL:0;PCL:0;RULEID:;SRVR:VI1PR06MB1053; x-forefront-prvs: 0799B1B2D7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(189002)(199003)(24454002)(81156007)(97736004)(5001770100001)(5001960100002)(19580395003)(189998001)(19580405001)(33716001)(66066001)(5002640100001)(101416001)(33656002)(50986999)(76176999)(54356999)(86362001)(87936001)(575784001)(5004730100002)(5008740100001)(11100500001)(2950100001)(2860100001)(2900100001)(586003)(3846002)(122556002)(1096002)(77096005)(1076002)(40100003)(1220700001)(102836003)(6116002)(105586002)(92566002)(106356001)(106116001)(10400500002)(13693001)(21314002)(357404004)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR06MB1053;H:VI1PR06MB1056.eurprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: visteon.com X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2015 09:37:01.6963 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7a147aaf-01ec-498c-80a1-e34a8c63c548 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB1053 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 23, 2015 at 02:33:29PM +0530, Niranjan Dighe wrote: > From: Niranjan Dighe > > Remove IOC_LIBCFS_MEMHOG ioctl functionality as it is no longer needed thereby > making functions like - kportal_memhog_alloc(), kportal_memhog_free() and type - > struct libcfs_device_userstate unused. > > Signed-off-by: Niranjan Dighe > --- > .../lustre/include/linux/libcfs/libcfs_private.h | 5 - > .../lustre/lustre/libcfs/linux/linux-module.c | 14 +- > drivers/staging/lustre/lustre/libcfs/module.c | 139 -------------------- > 3 files changed, 2 insertions(+), 156 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > index d6273e1..e044d6f 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h > @@ -391,11 +391,6 @@ int cfs_percpt_atomic_summary(atomic_t **refs); > * Support for temporary event tracing with minimal Heisenberg effect. > * -------------------------------------------------------------------- */ > > -struct libcfs_device_userstate { > - int ldu_memhog_pages; > - struct page *ldu_memhog_root_page; > -}; > - > #define MKSTR(ptr) ((ptr)) ? (ptr) : "" > > static inline int cfs_size_round4(int val) > diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c > index 70a99cf0..eccfe8bd 100644 > --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c > +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c > @@ -98,14 +98,12 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size) > static int > libcfs_psdev_open(struct inode *inode, struct file *file) > { > - struct libcfs_device_userstate **pdu = NULL; > int rc = 0; > > if (!inode) > return -EINVAL; > - pdu = (struct libcfs_device_userstate **)&file->private_data; > if (libcfs_psdev_ops.p_open != NULL) > - rc = libcfs_psdev_ops.p_open(0, (void *)pdu); > + rc = libcfs_psdev_ops.p_open(0, NULL); > else > return -EPERM; > return rc; > @@ -115,14 +113,12 @@ libcfs_psdev_open(struct inode *inode, struct file *file) > static int > libcfs_psdev_release(struct inode *inode, struct file *file) > { > - struct libcfs_device_userstate *pdu; > int rc = 0; > > if (!inode) > return -EINVAL; > - pdu = file->private_data; > if (libcfs_psdev_ops.p_close != NULL) > - rc = libcfs_psdev_ops.p_close(0, (void *)pdu); > + rc = libcfs_psdev_ops.p_close(0, NULL); > else > rc = -EPERM; > return rc; > @@ -152,14 +148,8 @@ static long libcfs_ioctl(struct file *file, > return -EPERM; > panic("debugctl-invoked panic"); > return 0; > - case IOC_LIBCFS_MEMHOG: > - if (!capable(CFS_CAP_SYS_ADMIN)) > - return -EPERM; > - /* go thought */ > } > > - pfile.off = 0; > - pfile.private_data = file->private_data; > if (libcfs_psdev_ops.p_ioctl != NULL) > rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void *)arg); > else > diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c > index 329d78c..0067e53 100644 > --- a/drivers/staging/lustre/lustre/libcfs/module.c > +++ b/drivers/staging/lustre/lustre/libcfs/module.c > @@ -68,142 +68,16 @@ MODULE_LICENSE("GPL"); > > static struct dentry *lnet_debugfs_root; > > -static void kportal_memhog_free(struct libcfs_device_userstate *ldu) > -{ > - struct page **level0p = &ldu->ldu_memhog_root_page; > - struct page **level1p; > - struct page **level2p; > - int count1; > - int count2; > - > - if (*level0p != NULL) { > - > - level1p = (struct page **)page_address(*level0p); > - count1 = 0; > - > - while (count1 < PAGE_CACHE_SIZE/sizeof(struct page *) && > - *level1p != NULL) { > - > - level2p = (struct page **)page_address(*level1p); > - count2 = 0; > - > - while (count2 < PAGE_CACHE_SIZE/sizeof(struct page *) && > - *level2p != NULL) { > - > - __free_page(*level2p); > - ldu->ldu_memhog_pages--; > - level2p++; > - count2++; > - } > - > - __free_page(*level1p); > - ldu->ldu_memhog_pages--; > - level1p++; > - count1++; > - } > - > - __free_page(*level0p); > - ldu->ldu_memhog_pages--; > - > - *level0p = NULL; > - } > - > - LASSERT(ldu->ldu_memhog_pages == 0); > -} > - > -static int kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages, > - gfp_t flags) > -{ > - struct page **level0p; > - struct page **level1p; > - struct page **level2p; > - int count1; > - int count2; > - > - LASSERT(ldu->ldu_memhog_pages == 0); > - LASSERT(ldu->ldu_memhog_root_page == NULL); > - > - if (npages < 0) > - return -EINVAL; > - > - if (npages == 0) > - return 0; > - > - level0p = &ldu->ldu_memhog_root_page; > - *level0p = alloc_page(flags); > - if (*level0p == NULL) > - return -ENOMEM; > - ldu->ldu_memhog_pages++; > - > - level1p = (struct page **)page_address(*level0p); > - count1 = 0; > - memset(level1p, 0, PAGE_CACHE_SIZE); > - > - while (ldu->ldu_memhog_pages < npages && > - count1 < PAGE_CACHE_SIZE/sizeof(struct page *)) { > - > - if (cfs_signal_pending()) > - return -EINTR; > - > - *level1p = alloc_page(flags); > - if (*level1p == NULL) > - return -ENOMEM; > - ldu->ldu_memhog_pages++; > - > - level2p = (struct page **)page_address(*level1p); > - count2 = 0; > - memset(level2p, 0, PAGE_CACHE_SIZE); > - > - while (ldu->ldu_memhog_pages < npages && > - count2 < PAGE_CACHE_SIZE/sizeof(struct page *)) { > - > - if (cfs_signal_pending()) > - return -EINTR; > - > - *level2p = alloc_page(flags); > - if (*level2p == NULL) > - return -ENOMEM; > - ldu->ldu_memhog_pages++; > - > - level2p++; > - count2++; > - } > - > - level1p++; > - count1++; > - } > - > - return 0; > -} > - > /* called when opening /dev/device */ > static int libcfs_psdev_open(unsigned long flags, void *args) > { > - struct libcfs_device_userstate *ldu; > - > try_module_get(THIS_MODULE); > - > - LIBCFS_ALLOC(ldu, sizeof(*ldu)); > - if (ldu != NULL) { > - ldu->ldu_memhog_pages = 0; > - ldu->ldu_memhog_root_page = NULL; > - } > - *(struct libcfs_device_userstate **)args = ldu; > - > return 0; > } > > /* called when closing /dev/device */ > static int libcfs_psdev_release(unsigned long flags, void *args) > { > - struct libcfs_device_userstate *ldu; > - > - ldu = (struct libcfs_device_userstate *)args; > - if (ldu != NULL) { > - kportal_memhog_free(ldu); > - LIBCFS_FREE(ldu, sizeof(*ldu)); > - } > - > module_put(THIS_MODULE); > return 0; > } > @@ -260,19 +134,6 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, > return -EINVAL; > libcfs_debug_mark_buffer(data->ioc_inlbuf1); > return 0; > - case IOC_LIBCFS_MEMHOG: > - if (pfile->private_data == NULL) { > - err = -EINVAL; > - } else { > - kportal_memhog_free(pfile->private_data); > - /* XXX The ioc_flags is not GFP flags now, need to be fixed */ > - err = kportal_memhog_alloc(pfile->private_data, > - data->ioc_count, > - data->ioc_flags); > - if (err != 0) > - kportal_memhog_free(pfile->private_data); > - } > - break; > > default: { > struct libcfs_ioctl_handler *hand; > -- > 1.7.9.5 Sorry for the subject line. Please ignore this. I will resend with correct subject. Regards, Niranjan