From nobody Tue Apr 7 02:56:26 2026 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74B052C11CF for ; Tue, 17 Mar 2026 02:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773715860; cv=none; b=ihCfoDJfOmZK4Ly2f4vf80jZDIONt9tnU4DEUooJiW+N53gspuIZY5l766dgi084NCcRenLTbsCC5ytErj935BSzX3D56cP/3l9NK023UO0pZPx0X3zw4FzvmE2gwdlEJq+TUA57Q6NEoFfftDiChLv+f4CFmPulbN0qIwadxBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773715860; c=relaxed/simple; bh=YKrvu+8KUko9GyvP4ENDHu+v4QBuGSrJspIEh3Z6nUU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TWB8aYzl/UVpn1L6gyuAW3zk9hpmal5GYa1pGFsVbrIlRau2OKq6/0Wkab/ZXLCi+Ph8EVsFHz5Ei8FxYLZ1H4VvqFmU3Z6qb68dpHQXfB5WmwjFw2/8dni8riSX7bFvIKgv3EXHb2hfyA5SqSAm0fLv+mWKrCVIRSILrU/bfHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=GT1D+Zcm; arc=none smtp.client-ip=209.85.128.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="GT1D+Zcm" Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-7927261a3acso42067317b3.0 for ; Mon, 16 Mar 2026 19:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773715858; x=1774320658; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PjOdhUZ1Sfc2pBNZkzIv/+F2L8hy1jAjYMY22sGDTyM=; b=GT1D+Zcm4kgCtQrN8a6pCE1RaN3M023FYAAkG5u6rBLOjE4yHNHq+HdSvA17QzzvWj EhJiaTmvLWWmYEogyJZPvdzAA4qU12u5+A0RAE5JfV74K7CfiJcEAn8lPhGRlIdL06tL YcekFbJv88bInwAyv/5oFsPWUQdcKqlKIGVW31TrEFo9BkrAG2o9MY8TWPvC4rymYxIq 9Tg7y9KTKSPxMruMsCL4TM1fVLhvyN9WxAfBgH+e52BhwhXRRoWcfPjFF67N0VDDVGyN nQ1sONh+d2TqRw2mNGNl5HsQjnbZ5RaCmfuo/qlOxsMJoRvsXUImaCIBBkmm8Jd/VanW sR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773715858; x=1774320658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=PjOdhUZ1Sfc2pBNZkzIv/+F2L8hy1jAjYMY22sGDTyM=; b=AVk1KfTC4jPdez3Em3mm0KLSVwDfDe5yxjbxxgKCIMqENySWlmDZUA0v6EZDy8HkNW fSXOKbvwbbunvErWD1DBSxZYDFFV07/KffCOr8B6iF2/XwPhv34GgzA0Zb05fT0EIipA fvQ0s/QYQxdyE3v1FE9CZ+7C5N9SjU367jz9p98uxX4t9vsUXspq+DyKwTXsCDTMJFO9 18ceiv7ViSicdE40OrOKJTjV5h7eWCJtp2/PvAMUwSGAmIMFHm/b9XHhbKfp7KQVeaV4 wXi+CWvjc1J8MRnce2CWC9EArFpwDGeBy244VHvVR0q5/yA89xQ6ZgMFtNycWPoNCiIQ DUOQ== X-Forwarded-Encrypted: i=1; AJvYcCXOwYvhd/jlFmjGQiGclcyiDAyxPdWEcFxzTsQSX2HC4D8158wj/rtmQYvXjWRmGzWumdcSO/Wvenjtjnw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0NpR6duSaMIeQoFckKnqI6wu1nNZOYeuMAKiaG+AlxgnKhMSX /2c26i2dZd0gJ1ZhCilpUfVV0toTy+yqOMO7H25ej7XA4Wr/H+S29x7MK3EnwkEPcSM= X-Gm-Gg: ATEYQzwXgzmeV7ENyDqqf7MY8FdnvfiTTAjRrXyKbaidpE2N0ltNdYmbfpMaqnl8owt 3Gbr92YuqYXzE6eVgpDq7fsg+7lGpd+aYJkpV91+WP/I1Ok0rmHF1A+engd+K1km6NMXd5SUvP7 b6XmkTduKrht+yyytKM5VfDkOFkh3WGF3lnO6lOOPpYYln0uzQ8cBPDd2BwL4Lvv96KG3qG/uFf 4HT0jaZhKO88+M7gZ+tmdrq5jWV4hi7zOKCYiENlZiXrTMVugvOw9/dbw1pB62qkBfXtmZU9zMJ UxBGCCtSaWA0KYyXon5dyw0lk/y9q7S5EhgmGXlo5FSVAjoCNkALoDdT1oj655jPlLOpRBI7cvm SDefcWJsjE9UvakzEVidYYlkkzN/YUO1hE7BI2Y4iChuRv77d/xEWjZ1LrLkItuUmApeTdkHqBL vkqbLcB/9E3EwxGyzOYGa3AhBhfwoK3k2lqzo/jCnHgI1Ju8ijj7SldMV52vlzCG/YIVcNQm7Y2 eUnHn9Xg/VgU9YxXaJzomp6uggtuK0J0BpEYow+bvQZ3k8bqw== X-Received: by 2002:a05:690c:660d:b0:79a:51df:6a0a with SMTP id 00721157ae682-79a51dfb37dmr49247187b3.60.1773715858519; Mon, 16 Mar 2026 19:50:58 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 00721157ae682-79a5a866c85sm14951757b3.35.2026.03.16.19.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 19:50:57 -0700 (PDT) From: Pasha Tatashin To: pasha.tatashin@soleen.com, rppt@kernel.org, pratyush@kernel.org, linux-kernel@vger.kernel.org, dmatlack@google.com, akpm@linux-foundation.org, linux-mm@kvack.org Subject: [PATCH 4/6] liveupdate: Defer FLB module refcounting to active sessions Date: Mon, 16 Mar 2026 22:50:47 -0400 Message-ID: <20260317025049.494931-5-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260317025049.494931-1-pasha.tatashin@soleen.com> References: <20260317025049.494931-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Stop pinning modules indefinitely upon FLB registration. Instead, dynamically take a module reference when the FLB is actively used in a session (e.g., during preserve and retrieve) and release it when the session concludes. This allows modules providing FLB operations to be cleanly unloaded when not in active use by the live update orchestrator. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_flb.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 91910d806d1d..daa852abdedd 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -112,10 +112,15 @@ static int luo_flb_file_preserve_one(struct liveupdat= e_flb *flb) struct liveupdate_flb_op_args args =3D {0}; int err; =20 + if (!try_module_get(flb->ops->owner)) + return -ENODEV; + args.flb =3D flb; err =3D flb->ops->preserve(&args); - if (err) + if (err) { + module_put(flb->ops->owner); return err; + } private->outgoing.data =3D args.data; private->outgoing.obj =3D args.obj; } @@ -143,6 +148,7 @@ static void luo_flb_file_unpreserve_one(struct liveupda= te_flb *flb) =20 private->outgoing.data =3D 0; private->outgoing.obj =3D NULL; + module_put(flb->ops->owner); } } } @@ -178,12 +184,17 @@ static int luo_flb_retrieve_one(struct liveupdate_flb= *flb) if (!found) return -ENOENT; =20 + if (!try_module_get(flb->ops->owner)) + return -ENODEV; + args.flb =3D flb; args.data =3D private->incoming.data; =20 err =3D flb->ops->retrieve(&args); - if (err) + if (err) { + module_put(flb->ops->owner); return err; + } =20 private->incoming.obj =3D args.obj; private->incoming.retrieved =3D true; @@ -217,6 +228,7 @@ static void luo_flb_file_finish_one(struct liveupdate_f= lb *flb) private->incoming.data =3D 0; private->incoming.obj =3D NULL; private->incoming.finished =3D true; + module_put(flb->ops->owner); } } } @@ -394,11 +406,6 @@ int liveupdate_register_flb(struct liveupdate_file_han= dler *fh, goto err_resume; } =20 - if (!try_module_get(flb->ops->owner)) { - err =3D -EAGAIN; - goto err_resume; - } - list_add_tail(&private->list, &luo_flb_global.list); luo_flb_global.count++; } @@ -479,7 +486,6 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, if (!private->users) { list_del_init(&private->list); luo_flb_global.count--; - module_put(flb->ops->owner); } =20 luo_session_resume(); @@ -506,7 +512,8 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, * * Return: 0 on success, or a negative errno on failure. -ENODATA means no * incoming FLB data, -ENOENT means specific flb not found in the incoming - * data, and -EOPNOTSUPP when live update is disabled or not configured. + * data, -ENODEV if the FLB's module is unloading, and -EOPNOTSUPP when + * live update is disabled or not configured. */ int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp) { --=20 2.53.0.851.ga537e3e6e9-goog