From: Jakub Kicinski Date: Sat, 7 Sep 2019 05:29:57 +0000 (-0700) Subject: net/tls: unref frags in order X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7ccd451912dd6407957676ae584248bdadc97b38;p=openwrt%2Fstaging%2Fblogic.git net/tls: unref frags in order It's generally more cache friendly to walk arrays in order, especially those which are likely not in cache. Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe Signed-off-by: David S. Miller --- diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 41c106e45f01..285c9f9e94e4 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -122,13 +122,10 @@ static struct net_device *get_netdev_for_sock(struct sock *sk) static void destroy_record(struct tls_record_info *record) { - int nr_frags = record->num_frags; - skb_frag_t *frag; + int i; - while (nr_frags-- > 0) { - frag = &record->frags[nr_frags]; - __skb_frag_unref(frag); - } + for (i = 0; i < record->num_frags; i++) + __skb_frag_unref(&record->frags[i]); kfree(record); }