behlendorf1@llnl.gov
2007-Jan-29 15:21 UTC
[Lustre-devel] [Bug 11622] Lustre Page Accounting
Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: https://bugzilla.lustre.org/show_bug.cgi?id=11622 Created an attachment (id=9441) Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: --> (https://bugzilla.lustre.org/attachment.cgi?id=9441&action=view) Page accounting patch
adilger@clusterfs.com
2007-Jan-29 23:30 UTC
[Lustre-devel] [Bug 11622] Lustre Page Accounting
Please don''t reply to lustre-devel. Instead, comment in Bugzilla by using the following link: https://bugzilla.lustre.org/show_bug.cgi?id=11622 What |Removed |Added ---------------------------------------------------------------------------- Attachment #9441| |review- Flag| | (From update of attachment 9441)>@@ -1877,7 +1877,7 @@ static int mds_setup(struct obd_device * > if (IS_ERR(obd->obd_fsops)) > RETURN(rc = PTR_ERR(obd->obd_fsops)); > >- page = __get_free_page(GFP_KERNEL); >+ OBD_PAGE_ADDR_ALLOC(page, GFP_KERNEL); > if (!page) > RETURN(-ENOMEM); > >@@ -1897,7 +1897,7 @@ static int mds_setup(struct obd_device * > > mnt = do_kern_mount(lustre_cfg_string(lcfg, 2), 0, > lustre_cfg_string(lcfg, 1), (void *)options); >- free_page(page); >+ OBD_PAGE_ADDR_FREE(page); > if (IS_ERR(mnt)) { > rc = PTR_ERR(mnt); > LCONSOLE_ERROR("Can''t mount disk %s (%d)\n", >@@ -1737,14 +1737,15 @@ static int filter_setup(struct obd_devic > RETURN(-EINVAL); > > /* 2.6.9 selinux wants a full option page for do_kern_mount (bug6471) */ >- page = get_zeroed_page(GFP_KERNEL); >+ OBD_PAGE_ADDR_ALLOC(page, GFP_KERNEL); > if (!page) > RETURN(-ENOMEM); > >+ clear_page((void *)page); > memcpy((void *)page, lustre_cfg_buf(lcfg, 4), > LUSTRE_CFG_BUFLEN(lcfg, 4)); > rc = filter_common_setup(obd, len, buf, (void *)page); >- free_page(page); >+ OBD_PAGE_ADDR_FREE(page); > > lprocfs_init_vars(filter, &lvars); > if (rc == 0 && lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && >@@ -48,7 +48,7 @@ int filter_san_setup(struct obd_device * > RETURN(-EINVAL); > > /* 2.6.9 selinux wants a full option page for do_kern_mount (bug6471) */ >- page = get_zeroed_page(GFP_KERNEL); >+ OBD_PAGE_ADDR_ALLOC(page, GFP_KERNEL); > if (!page) > RETURN(-ENOMEM); > >@@ -61,7 +61,7 @@ int filter_san_setup(struct obd_device * > LBUG(); /* just a reminder */ > > rc = filter_common_setup(obd, len, buf, (void *)page); >- free_page(page); >+ OBD_PAGE_ADDR_FREE(page); > > return rc; > }For the 3 times this macro is used, we may as well just be consistent and use OBD_PAGE_ALLOC() and do page_address() in the caller. In fact, the filter_san_*() functions are obsolete and deleted in b1_5 CVS. Also, it would likely be consistent to zero the MDS page (even if it isn''t currently done), and the filter_san_setup() also doesn''t zero the page when it was previously done (not that this really matters much.>@@ -51,7 +51,9 @@ > #include <linux/lustre_quota.h> > > atomic_t obd_memory; >+atomic_t obd_memory_pages; > int obd_memmax; >+int obd_memmax_pages;Hmm, is it just me, or do these variables seem too small to handle very much allocation? I might be able to believe that 2^24 pages (max stomic_t, 64GB in total) is more than we _currently_ alloc, but I''m guessing that we can allocate a LOT more than 16MB of RAM at one time. That might be why we don''t report very much memory used. I suspect if we had a per-CPU long and only added them together when reading from /proc/sys/{lustre,lnet}/memused we could avoid locking in the fast path. Even if we have skew due to allocating on one CPU and freeing in the other the sum should always be consistent.