All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Change allocation from kmalloc() to stack
@ 2021-07-28 12:51 Goldwyn Rodrigues
  2021-07-27 21:17 ` [PATCH 1/7] btrfs: Allocate walk_control on stack Goldwyn Rodrigues
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Goldwyn Rodrigues @ 2021-07-28 12:51 UTC (permalink / raw)
  To: linux-btrfs

Apparently, git send-email --compose missed to send PATCH 0/7. So
sending again and hoping it lands in the right place...

Here are some structs which can be converted to allocation on stack in order
to save on post-checks on kmalloc() and kfree() each of them.

Sizes of the structures are also in the commit message in case you feel they
are too bit to be allocated on stack.

There are two more structs in ioctl.c which can be converted, but
I was not sure of them:

1. In create_snapshot(), pending_snapshot can be converted. pending_snapshot
   is used in the transaction.
2. In btrfs_ioctl_set_received_subvol_32, args64 can be converted, but args32
   cannot. All Pointers associated with memdup_user() can also be converted
   by using copy_from_user() instead. This would include many more structs.

Goldwyn Rodrigues (7):
  btrfs: Allocate walk_control on stack
  btrfs: Allocate file_ra_state on stack
  btrfs: Allocate btrfs_ioctl_get_subvol_info_args on stack
  btrfs: Allocate btrfs_ioctl_balance_args on stack
  btrfs: Allocate btrfs_ioctl_quota_rescan_args on stack
  btrfs: Allocate btrfs_ioctl_defrag_range_args on stack
  btrfs: Alloc backref_ctx on stack

 fs/btrfs/extent-tree.c      |  89 +++++++++++++-----------------
 fs/btrfs/free-space-cache.c |  12 ++---
 fs/btrfs/ioctl.c            | 105 ++++++++++++++----------------------
 fs/btrfs/send.c             |  29 ++++------
 4 files changed, 89 insertions(+), 146 deletions(-)

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 0/7] Allocate structures on stack instead of kmalloc()
@ 2021-07-27 21:17 Goldwyn Rodrigues
  2021-07-29 16:51 ` David Sterba
  0 siblings, 1 reply; 24+ messages in thread
From: Goldwyn Rodrigues @ 2021-07-27 21:17 UTC (permalink / raw)
  To: linux-btrfs

Here are some structs which can be converted to allocation on stack in order
to save on post-checks on kmalloc() and kfree() each of them.

Sizes of the structures are also in the commit message in case you feel they
are too bit to be allocated on stack.

There are two more structs in ioctl.c which can be converted, but
I was not sure of them:

1. In create_snapshot(), pending_snapshot can be converted. pending_snapshot
   is used in the transaction.
2. In btrfs_ioctl_set_received_subvol_32, args64 can be converted, but args32
   cannot. All Pointers associated with memdup_user() can also be converted
   by using copy_from_user() instead. This would include many more structs.

Goldwyn Rodrigues (7):
  btrfs: Allocate walk_control on stack
  btrfs: Allocate file_ra_state on stack
  btrfs: Allocate btrfs_ioctl_get_subvol_info_args on stack
  btrfs: Allocate btrfs_ioctl_balance_args on stack
  btrfs: Allocate btrfs_ioctl_quota_rescan_args on stack
  btrfs: Allocate btrfs_ioctl_defrag_range_args on stack
  btrfs: Alloc backref_ctx on stack

 fs/btrfs/extent-tree.c      |  89 +++++++++++++-----------------
 fs/btrfs/free-space-cache.c |  12 ++---
 fs/btrfs/ioctl.c            | 105 ++++++++++++++----------------------
 fs/btrfs/send.c             |  29 ++++------
 4 files changed, 89 insertions(+), 146 deletions(-)



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-07-29 17:25 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 12:51 [PATCH 0/7] Change allocation from kmalloc() to stack Goldwyn Rodrigues
2021-07-27 21:17 ` [PATCH 1/7] btrfs: Allocate walk_control on stack Goldwyn Rodrigues
2021-07-28  5:11   ` Anand Jain
2021-07-28  5:25     ` Anand Jain
2021-07-28 11:08   ` David Sterba
2021-07-27 21:17 ` [PATCH 2/7] btrfs: Allocate file_ra_state " Goldwyn Rodrigues
2021-07-28  5:29   ` Anand Jain
2021-07-27 21:17 ` [PATCH 3/7] btrfs: Allocate btrfs_ioctl_get_subvol_info_args " Goldwyn Rodrigues
2021-07-28  5:59   ` Anand Jain
2021-07-29 17:08   ` David Sterba
2021-07-29 17:22   ` David Sterba
2021-07-27 21:17 ` [PATCH 4/7] btrfs: Allocate btrfs_ioctl_balance_args " Goldwyn Rodrigues
2021-07-28  0:02   ` Darrick J. Wong
2021-07-28  2:04     ` Goldwyn Rodrigues
2021-07-28  1:19   ` kernel test robot
2021-07-28  1:19     ` kernel test robot
2021-07-27 21:17 ` [PATCH 5/7] btrfs: Allocate btrfs_ioctl_quota_rescan_args " Goldwyn Rodrigues
2021-07-28  6:01   ` Anand Jain
2021-07-27 21:17 ` [PATCH 6/7] btrfs: Allocate btrfs_ioctl_defrag_range_args " Goldwyn Rodrigues
2021-07-28  6:27   ` Anand Jain
2021-07-27 21:17 ` [PATCH 7/7] btrfs: Alloc backref_ctx " Goldwyn Rodrigues
2021-07-28  6:30   ` Anand Jain
  -- strict thread matches above, loose matches on Subject: below --
2021-07-27 21:17 [PATCH 0/7] Allocate structures on stack instead of kmalloc() Goldwyn Rodrigues
2021-07-29 16:51 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.