From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Xin Long <lucien.xin@gmail.com>,
Jon Maloy <jmaloy@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 031/102] tipc: simplify the finalize work queue
Date: Mon, 27 Jun 2022 13:20:42 +0200 [thread overview]
Message-ID: <20220627111934.389114522@linuxfoundation.org> (raw)
In-Reply-To: <20220627111933.455024953@linuxfoundation.org>
From: Xin Long <lucien.xin@gmail.com>
[ Upstream commit be07f056396d6bb40963c45a02951c566ddeef8e ]
This patch is to use "struct work_struct" for the finalize work queue
instead of "struct tipc_net_work", as it can get the "net" and "addr"
from tipc_net's other members and there is no need to add extra net
and addr in tipc_net by defining "struct tipc_net_work".
Note that it's safe to get net from tn->bcl as bcl is always released
after the finalize work queue is done.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tipc/core.c | 4 ++--
net/tipc/core.h | 8 +-------
net/tipc/discover.c | 4 ++--
net/tipc/link.c | 5 +++++
net/tipc/link.h | 1 +
net/tipc/net.c | 15 +++------------
6 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 40c03085c0ea..96bfcb2986f5 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -60,7 +60,7 @@ static int __net_init tipc_init_net(struct net *net)
tn->trial_addr = 0;
tn->addr_trial_end = 0;
tn->capabilities = TIPC_NODE_CAPABILITIES;
- INIT_WORK(&tn->final_work.work, tipc_net_finalize_work);
+ INIT_WORK(&tn->work, tipc_net_finalize_work);
memset(tn->node_id, 0, sizeof(tn->node_id));
memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
@@ -112,7 +112,7 @@ static void __net_exit tipc_exit_net(struct net *net)
tipc_detach_loopback(net);
/* Make sure the tipc_net_finalize_work() finished */
- cancel_work_sync(&tn->final_work.work);
+ cancel_work_sync(&tn->work);
tipc_net_stop(net);
tipc_bcast_stop(net);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 992924a849be..73a26b0b9ca1 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -90,12 +90,6 @@ extern unsigned int tipc_net_id __read_mostly;
extern int sysctl_tipc_rmem[3] __read_mostly;
extern int sysctl_tipc_named_timeout __read_mostly;
-struct tipc_net_work {
- struct work_struct work;
- struct net *net;
- u32 addr;
-};
-
struct tipc_net {
u8 node_id[NODE_ID_LEN];
u32 node_addr;
@@ -150,7 +144,7 @@ struct tipc_net {
struct tipc_crypto *crypto_tx;
#endif
/* Work item for net finalize */
- struct tipc_net_work final_work;
+ struct work_struct work;
/* The numbers of work queues in schedule */
atomic_t wq_count;
};
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index d4ecacddb40c..14bc20604051 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -167,7 +167,7 @@ static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,
/* Apply trial address if we just left trial period */
if (!trial && !self) {
- tipc_sched_net_finalize(net, tn->trial_addr);
+ schedule_work(&tn->work);
msg_set_prevnode(buf_msg(d->skb), tn->trial_addr);
msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);
}
@@ -307,7 +307,7 @@ static void tipc_disc_timeout(struct timer_list *t)
if (!time_before(jiffies, tn->addr_trial_end) && !tipc_own_addr(net)) {
mod_timer(&d->timer, jiffies + TIPC_DISC_INIT);
spin_unlock_bh(&d->lock);
- tipc_sched_net_finalize(net, tn->trial_addr);
+ schedule_work(&tn->work);
return;
}
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 7a353ff62844..064fdb8e50e1 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -344,6 +344,11 @@ char tipc_link_plane(struct tipc_link *l)
return l->net_plane;
}
+struct net *tipc_link_net(struct tipc_link *l)
+{
+ return l->net;
+}
+
void tipc_link_update_caps(struct tipc_link *l, u16 capabilities)
{
l->peer_caps = capabilities;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index fc07232c9a12..a16f401fdabd 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -156,4 +156,5 @@ int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,
struct sk_buff_head *xmitq);
bool tipc_link_too_silent(struct tipc_link *l);
+struct net *tipc_link_net(struct tipc_link *l);
#endif
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 0bb2323201da..671cb4f9d563 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -41,6 +41,7 @@
#include "socket.h"
#include "node.h"
#include "bcast.h"
+#include "link.h"
#include "netlink.h"
#include "monitor.h"
@@ -138,19 +139,9 @@ static void tipc_net_finalize(struct net *net, u32 addr)
void tipc_net_finalize_work(struct work_struct *work)
{
- struct tipc_net_work *fwork;
+ struct tipc_net *tn = container_of(work, struct tipc_net, work);
- fwork = container_of(work, struct tipc_net_work, work);
- tipc_net_finalize(fwork->net, fwork->addr);
-}
-
-void tipc_sched_net_finalize(struct net *net, u32 addr)
-{
- struct tipc_net *tn = tipc_net(net);
-
- tn->final_work.net = net;
- tn->final_work.addr = addr;
- schedule_work(&tn->final_work.work);
+ tipc_net_finalize(tipc_link_net(tn->bcl), tn->trial_addr);
}
void tipc_net_stop(struct net *net)
--
2.35.1
next prev parent reply other threads:[~2022-06-27 11:24 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 11:20 [PATCH 5.10 000/102] 5.10.127-rc1 review Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 001/102] vt: drop old FONT ioctls Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 002/102] random: schedule mix_interrupt_randomness() less often Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 003/102] random: quiet urandom warning ratelimit suppression message Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 004/102] ALSA: hda/via: Fix missing beep setup Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 005/102] ALSA: hda/conexant: " Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 006/102] ALSA: hda/realtek: Add mute LED quirk for HP Omen laptop Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 007/102] ALSA: hda/realtek - ALC897 headset MIC no sound Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 008/102] ALSA: hda/realtek: Apply fixup for Lenovo Yoga Duet 7 properly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 009/102] ALSA: hda/realtek: Add quirk for Clevo PD70PNT Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 010/102] ALSA: hda/realtek: Add quirk for Clevo NS50PU Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 011/102] net: openvswitch: fix parsing of nw_proto for IPv6 fragments Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 012/102] btrfs: add error messages to all unrecognized mount options Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 013/102] mmc: sdhci-pci-o2micro: Fix card detect by dealing with debouncing Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 014/102] mtd: rawnand: gpmi: Fix setting busy timeout setting Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 015/102] ata: libata: add qc->flags in ata_qc_complete_template tracepoint Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 016/102] dm era: commit metadata in postsuspend after worker stops Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 017/102] dm mirror log: clear log bits up to BITS_PER_LONG boundary Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 018/102] USB: serial: option: add Telit LE910Cx 0x1250 composition Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 019/102] USB: serial: option: add Quectel EM05-G modem Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 020/102] USB: serial: option: add Quectel RM500K module support Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 021/102] drm/msm: Fix double pm_runtime_disable() call Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 022/102] netfilter: nftables: add nft_parse_register_load() and use it Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 023/102] netfilter: nftables: add nft_parse_register_store() " Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 024/102] netfilter: use get_random_u32 instead of prandom Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 025/102] scsi: scsi_debug: Fix zone transition to full condition Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 026/102] drm/msm: use for_each_sgtable_sg to iterate over scatterlist Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 027/102] bpf: Fix request_sock leak in sk lookup helpers Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 028/102] drm/sun4i: Fix crash during suspend after component bind failure Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 029/102] bpf, x86: Fix tail call count offset calculation on bpf2bpf call Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 030/102] phy: aquantia: Fix AN when higher speeds than 1G are not advertised Greg Kroah-Hartman
2022-06-27 11:20 ` Greg Kroah-Hartman [this message]
2022-06-27 11:20 ` [PATCH 5.10 032/102] tipc: fix use-after-free Read in tipc_named_reinit Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 033/102] igb: fix a use-after-free issue in igb_clean_tx_ring Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 034/102] bonding: ARP monitor spams NETDEV_NOTIFY_PEERS notifiers Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 035/102] net/sched: sch_netem: Fix arithmetic in netem_dump() for 32-bit platforms Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 036/102] drm/msm/mdp4: Fix refcount leak in mdp4_modeset_init_intf Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 037/102] drm/msm/dp: check core_initialized before disable interrupts at dp_display_unbind() Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 038/102] drm/msm/dp: fixes wrong connection state caused by failure of link train Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 039/102] drm/msm/dp: deinitialize mainlink if link training failed Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 040/102] drm/msm/dp: promote irq_hpd handle to handle link training correctly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 041/102] drm/msm/dp: fix connect/disconnect handled at irq_hpd Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 042/102] erspan: do not assume transport header is always set Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 043/102] net/tls: fix tls_sk_proto_close executed repeatedly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 044/102] udmabuf: add back sanity check Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 045/102] selftests: netfilter: correct PKTGEN_SCRIPT_PATHS in nft_concat_range.sh Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 046/102] x86/xen: Remove undefined behavior in setup_features() Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 047/102] MIPS: Remove repetitive increase irq_err_count Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 048/102] afs: Fix dynamic root getattr Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 049/102] ice: ethtool: advertise 1000M speeds properly Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 050/102] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 051/102] igb: Make DMA faster when CPU is active on the PCIe link Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 052/102] virtio_net: fix xdp_rxq_info bug after suspend/resume Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 053/102] Revert "net/tls: fix tls_sk_proto_close executed repeatedly" Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 054/102] nvme: centralize setting the timeout in nvme_alloc_request Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 055/102] nvme: split nvme_alloc_request() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 056/102] nvme: mark nvme_setup_passsthru() inline Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 057/102] nvme: dont check nvme_req flags for new req Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 058/102] nvme-pci: allocate nvme_command within driver pdu Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 059/102] nvme-pci: add NO APST quirk for Kioxia device Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 060/102] nvme: move the Samsung X5 quirk entry to the core quirks Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 061/102] gpio: winbond: Fix error code in winbond_gpio_get() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 062/102] s390/cpumf: Handle events cycles and instructions identical Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 063/102] iio: mma8452: fix probe fail when device tree compatible is used Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 064/102] iio: adc: vf610: fix conversion mode sysfs node name Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 065/102] usb: typec: wcove: Drop wrong dependency to INTEL_SOC_PMIC Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 066/102] xhci: turn off port power in shutdown Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 067/102] xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 068/102] xhci-pci: Allow host runtime PM as default for Intel Meteor " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 069/102] usb: gadget: Fix non-unique driver names in raw-gadget driver Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 070/102] USB: gadget: Fix double-free bug in raw_gadget driver Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 071/102] usb: chipidea: udc: check request status before setting device address Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 072/102] f2fs: attach inline_data after setting compression Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 073/102] iio:chemical:ccs811: rearrange iio trigger get and register Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 074/102] iio:accel:bma180: " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 075/102] iio:accel:mxc4005: " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 076/102] iio: accel: mma8452: ignore the return value of reset operation Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 077/102] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 078/102] iio: trigger: sysfs: fix use-after-free on remove Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 079/102] iio: adc: stm32: fix maximum clock rate for stm32mp15x Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 080/102] iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value) Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 081/102] iio: adc: stm32: Fix ADCs iteration in irq handler Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 082/102] iio: adc: stm32: Fix IRQs on STM32F4 by removing custom spurious IRQs message Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 083/102] iio: adc: axp288: Override TS pin bias current for some models Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 084/102] iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 085/102] xtensa: xtfpga: Fix refcount leak bug in setup Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 086/102] xtensa: Fix refcount leak bug in time.c Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 087/102] parisc/stifb: Fix fb_is_primary_device() only available with CONFIG_FB_STI Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 088/102] parisc: Enable ARCH_HAS_STRICT_MODULE_RWX Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 089/102] powerpc: Enable execve syscall exit tracepoint Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 090/102] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 091/102] powerpc/powernv: wire up rng during setup_arch Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 092/102] ARM: dts: imx7: Move hsic_phy power domain to HSIC PHY node Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 093/102] ARM: dts: imx6qdl: correct PU regulator ramp delay Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 094/102] ARM: exynos: Fix refcount leak in exynos_map_pmu Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 095/102] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 096/102] ARM: Fix refcount leak in axxia_boot_secondary Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 097/102] memory: samsung: exynos5422-dmc: Fix refcount leak in of_get_dram_timings Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 098/102] ARM: cns3xxx: Fix refcount leak in cns3xxx_init Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 099/102] modpost: fix section mismatch check for exported init/exit sections Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 100/102] random: update comment from copy_to_user() -> copy_to_iter() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 101/102] kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS (2nd attempt) Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 102/102] powerpc/pseries: wire up rng during setup_arch() Greg Kroah-Hartman
2022-06-27 17:05 ` [PATCH 5.10 000/102] 5.10.127-rc1 review Florian Fainelli
2022-06-27 18:52 ` Daniel Díaz
2022-06-27 21:56 ` Shuah Khan
2022-06-27 23:41 ` Guenter Roeck
2022-06-28 13:17 ` Sudip Mukherjee
2022-06-29 1:07 ` Samuel Zou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220627111934.389114522@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=jmaloy@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome