Avoid holding the zero page on slab init failure
PATCH 1/1 Avoid holding the zero page on slab init failure
Spotted by visual inspection.
Applies on libceph: Remove spurious kunmap() of the zero page.
Benoît Canet (1):
libceph: Avoid holding the zero page on ceph_msgr_slab_init errors
net/ceph/messenger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 libceph: Avoid holding the zero page on ceph_msgr_slab_init errors
ceph_msgr_slab_init may fail due to a temporary ENOMEM.
Delay a bit the initialization of zero_page in ceph_msgr_init and reorder it's cleanup in _ceph_msgr_exit for readability sake.
BUG_ON() will not suffer to be postponed in case it is triggered.
--- net/ceph/messenger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/ceph/messenger.c +5 -5
@@ -275,22 +275,22 @@ static void _ceph_msgr_exit(void) ceph_msgr_wq =NULL ; } -ceph_msgr_slab_exit (); -BUG_ON (zero_page ==NULL );page_cache_release (zero_page); zero_page =NULL ; + +ceph_msgr_slab_exit (); }int ceph_msgr_init (void ) { +if (ceph_msgr_slab_init ()) +return -ENOMEM ; +BUG_ON (zero_page !=NULL ); zero_page =ZERO_PAGE (0 );page_cache_get (zero_page); -if (ceph_msgr_slab_init ()) -return -ENOMEM ; -/* * The number of active work items is limited by the number of * connections, so leave @max_active at default.
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libceph: Avoid holding the zero page on ceph_msgr_slab_init errors
Quoted 1 line · Benoît Canet
ceph_msgr_slab_initmay fail due to a temporary ENOMEM.
Looks good.
Quoted 2 lines
Delay a bit the initialization of
zero_pageinceph_msgr_initand reorder it's cleanup in_ceph_msgr_exitfor readability sake.
I'd say it's not readability, but a proper ordering (tear down in reverse order of set up).
Quoted 1 line
BUG_ON()will not suffer to be postponed in case it is triggered.
This is unrelated, but in cases like this (where there's already something in place to return an error) we should replace these BUG_ON() calls with logged errors and a return. They should never ever happen, of course (they represent design problems) but if it did it's better to allow the system to keep running.
Quoted 28 lines
Signed-off-by Benoît Canet <[email protected]>--- net/ceph/messenger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)net/ceph/messenger.c +5
-2@@ -275,22 +275,22 @@ static void _ceph_msgr_exit(void) ceph_msgr_wq =NULL ; } -ceph_msgr_slab_exit (); -BUG_ON (zero_page ==NULL );page_cache_release (zero_page); zero_page =NULL ; + +ceph_msgr_slab_exit (); }int ceph_msgr_init (void ) { +if (ceph_msgr_slab_init ()) +return -ENOMEM ; +
net/ceph/messenger.c static void _ceph_msgr_exit(void) · line 296
Quoted 10 lines
net/ceph/messenger.c +0
-3BUG_ON (zero_page !=NULL ); zero_page =ZERO_PAGE (0 );page_cache_get (zero_page); -if (ceph_msgr_slab_init ()) -return -ENOMEM ; -/* * The number of active work items is limited by the number of * connections, so leave @max_active at default.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Benoît Canet
Spotted by visual inspection.
Applies on libceph: Remove spurious
kunmap()of the zero page.Benoît Canet (1):
libceph: Avoid holding the zero page onceph_msgr_slab_initerrorsnet/ceph/messenger.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Benoit, in cases where you have just a single patch, there is no need to include an additional mail message like this one.
If you have a series, that's when you'll supply a PATCH 0/N message.
-Alex
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html