Skip to content

Commit 1036908

Browse files
edumazetdavem330
authored andcommitted
net: reclaim skb->scm_io_uring bit
Commit 0091bfc ("io_uring/af_unix: defer registered files gc to io_uring release") added one bit to struct sk_buff. This structure is critical for networking, and we try very hard to not add bloat on it, unless absolutely required. For instance, we can use a specific destructor as a wrapper around unix_destruct_scm(), to identify skbs that unix_gc() has to special case. Signed-off-by: Eric Dumazet <[email protected]> Cc: Pavel Begunkov <[email protected]> Cc: Thadeu Lima de Souza Cascardo <[email protected]> Cc: Jens Axboe <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Reviewed-by: Pavel Begunkov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b3f4cd0 commit 1036908

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

include/linux/skbuff.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,6 @@ typedef unsigned char *sk_buff_data_t;
810810
* @csum_level: indicates the number of consecutive checksums found in
811811
* the packet minus one that have been verified as
812812
* CHECKSUM_UNNECESSARY (max 3)
813-
* @scm_io_uring: SKB holds io_uring registered files
814813
* @dst_pending_confirm: need to confirm neighbour
815814
* @decrypted: Decrypted SKB
816815
* @slow_gro: state present at GRO time, slower prepare step required
@@ -989,7 +988,6 @@ struct sk_buff {
989988
#endif
990989
__u8 slow_gro:1;
991990
__u8 csum_not_inet:1;
992-
__u8 scm_io_uring:1;
993991

994992
#ifdef CONFIG_NET_SCHED
995993
__u16 tc_index; /* traffic control index */

include/net/af_unix.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
void unix_inflight(struct user_struct *user, struct file *fp);
1212
void unix_notinflight(struct user_struct *user, struct file *fp);
1313
void unix_destruct_scm(struct sk_buff *skb);
14+
void io_uring_destruct_scm(struct sk_buff *skb);
1415
void unix_gc(void);
1516
void wait_for_unix_gc(void);
1617
struct sock *unix_get_socket(struct file *filp);

io_uring/rsrc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ int __io_scm_file_account(struct io_ring_ctx *ctx, struct file *file)
867867

868868
UNIXCB(skb).fp = fpl;
869869
skb->sk = sk;
870-
skb->scm_io_uring = 1;
871-
skb->destructor = unix_destruct_scm;
870+
skb->destructor = io_uring_destruct_scm;
872871
refcount_add(skb->truesize, &sk->sk_wmem_alloc);
873872
}
874873

net/unix/garbage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void unix_gc(void)
305305
* release.path eventually putting registered files.
306306
*/
307307
skb_queue_walk_safe(&hitlist, skb, next_skb) {
308-
if (skb->scm_io_uring) {
308+
if (skb->destructor == io_uring_destruct_scm) {
309309
__skb_unlink(skb, &hitlist);
310310
skb_queue_tail(&skb->sk->sk_receive_queue, skb);
311311
}

net/unix/scm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,9 @@ void unix_destruct_scm(struct sk_buff *skb)
152152
sock_wfree(skb);
153153
}
154154
EXPORT_SYMBOL(unix_destruct_scm);
155+
156+
void io_uring_destruct_scm(struct sk_buff *skb)
157+
{
158+
unix_destruct_scm(skb);
159+
}
160+
EXPORT_SYMBOL(io_uring_destruct_scm);

0 commit comments

Comments
 (0)