[pve-devel] SPAM: [PATCH lxcfs] bump version to 4.0.7-pve1

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 14 15:57:49 CEST 2021


On 14.04.21 14:24, Oguz Bektas wrote:
> remove patches since they're already applied upstream
> 

please ensure that your git-send-email does not picks up S-b, R-b, etc. git trailers
of patches by patches and wrongly CC's those people like happened here.

Further, separate debian/changelog entries from the actual changes, in general
rather not send updates to debian/changelog.

It would be also good to have a short summary of changes/fixes/features from that
new release, i.e., why should be update (what's fixed, or what's changed and thus
a potential regression?)...

> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  debian/changelog                              |   6 ++
>  ...t-swap-values-when-no-limit-or-equal.patch |  38 -------
>  .../pve/0002-README-clarify-SWAP.patch        |  71 ------------
>  ...03-cgroups-Add-get_memory_swappiness.patch |  55 ----------
>  .../pve/0004-swap-Fix-usage-reporting.patch   |  29 -----
>  ...ly-report-usage-when-swappiness-is-0.patch | 102 ------------------
>  .../pve/0006-swap-Tweak-meminfo-logic.patch   |  72 -------------
>  ...p-Make-proc-swaps-match-proc-meminfo.patch |  89 ---------------
>  ...0008-swap-Remove-now-unused-variable.patch |  38 -------
>  debian/patches/series                         |   8 --
>  lxcfs                                         |   2 +-
>  11 files changed, 7 insertions(+), 503 deletions(-)
>  delete mode 100644 debian/patches/pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
>  delete mode 100644 debian/patches/pve/0002-README-clarify-SWAP.patch
>  delete mode 100644 debian/patches/pve/0003-cgroups-Add-get_memory_swappiness.patch
>  delete mode 100644 debian/patches/pve/0004-swap-Fix-usage-reporting.patch
>  delete mode 100644 debian/patches/pve/0005-swap-Only-report-usage-when-swappiness-is-0.patch
>  delete mode 100644 debian/patches/pve/0006-swap-Tweak-meminfo-logic.patch
>  delete mode 100644 debian/patches/pve/0007-swap-Make-proc-swaps-match-proc-meminfo.patch
>  delete mode 100644 debian/patches/pve/0008-swap-Remove-now-unused-variable.patch
> 
> diff --git a/debian/changelog b/debian/changelog
> index b96eaaa..6d7c3f9 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,9 @@
> +lxcfs (4.0.7-pve1) pve; urgency=medium
> +
> +  * update to 4.0.7
> +
> + -- Proxmox Support Team <support at proxmox.com>  Tue, 13 Apr 2021 13:59:07 +0100
> +
>  lxcfs (4.0.6-pve1) pve; urgency=medium
>  
>    * update to 4.0.6
> diff --git a/debian/patches/pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch b/debian/patches/pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
> deleted file mode 100644
> index 8011eb1..0000000
> --- a/debian/patches/pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -From 8a0e1fd9d0c8866af5947ab2acee0c28e8827573 Mon Sep 17 00:00:00 2001
> -From: Christian Brauner <christian.brauner at ubuntu.com>
> -Date: Tue, 3 Nov 2020 22:27:05 +0100
> -Subject: [PATCH lxcfs 1/8] meminfo: show host swap values when no limit or
> - equal limits are set
> -
> -Closes: #434
> -Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
> ----
> - src/proc_fuse.c | 12 +++++++++++-
> - 1 file changed, 11 insertions(+), 1 deletion(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index 907f5c7..7bc1eb0 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -1243,7 +1243,17 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 
> - 				sscanf(line + STRLITERALLEN("SwapTotal:"), "%" PRIu64, &hostswtotal);
> - 
> --				if (hostswtotal < swtotal) {
> -+				/*
> -+				 * If swtotal is 0 it should mean that
> -+				 * memory.memsw.limit_in_bytes and
> -+				 * memory.limit_in_bytes are both unlimited or
> -+				 * both set to the same value. In both cases we
> -+				 * have no idea what the technical swap limit
> -+				 * is supposed to be (It's a shared limit
> -+				 * anyway.) so fallback to the host's values in
> -+				 * that case too.
> -+				 */
> -+				if ((hostswtotal < swtotal) || swtotal == 0) {
> - 					swtotal = hostswtotal;
> - 					host_swap = true;
> - 				}
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0002-README-clarify-SWAP.patch b/debian/patches/pve/0002-README-clarify-SWAP.patch
> deleted file mode 100644
> index 219527a..0000000
> --- a/debian/patches/pve/0002-README-clarify-SWAP.patch
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -From 22ba5818484aa5ffaa26967d5d2ab228b2789205 Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Wed, 4 Nov 2020 23:06:00 -0500
> -Subject: [PATCH lxcfs 2/8] README: clarify SWAP
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> - 1 file changed, 47 insertions(+)
> -
> -diff --git a/README.md b/README.md
> -index 5272a6c..3c638c3 100644
> ---- a/README.md
> -+++ b/README.md
> -@@ -104,3 +104,50 @@ docker run -it -m 256m --memory-swap 256m \
> -  In a system with swap enabled, the parameter "-u" can be used to set all values in "meminfo" that refer to the swap to 0.
> - 
> -  sudo lxcfs -u /var/lib/lxcfs
> -+
> -+## Swap handling
> -+If you noticed LXCFS not showing any SWAP in your container despite
> -+having SWAP on your system, please read this section carefully and look
> -+for instructions on how to enable SWAP accounting for your distribution.
> -+
> -+Swap cgroup handling on Linux is very confusing and there just isn't a
> -+perfect way for LXCFS to handle it.
> -+
> -+Terminology used below:
> -+ - RAM refers to `memory.usage_in_bytes` and `memory.limit_in_bytes`
> -+ - RAM+SWAP refers to `memory.memsw.usage_in_bytes` and `memory.memsw.limit_in_bytes`
> -+
> -+The main issues are:
> -+ - SWAP accounting is often opt-in and, requiring a special kernel boot
> -+   time option (`swapaccount=1`) and/or special kernel build options
> -+   (`CONFIG_MEMCG_SWAP`).
> -+
> -+ - Both a RAM limit and a RAM+SWAP limit can be set. The delta however
> -+   isn't the available SWAP space as the kernel is still free to SWAP as
> -+   much of the RAM as it feels like. This makes it impossible to render
> -+   a SWAP device size as using the delta between RAM and RAM+SWAP for that
> -+   wouldn't account for the kernel swapping more pages, leading to swap
> -+   usage exceeding swap total.
> -+
> -+ - It's impossible to disable SWAP in a given container. The closest
> -+   that can be done is setting swappiness down to 0 which severly limits
> -+   the risk of swapping pages but doesn't eliminate it.
> -+
> -+As a result, LXCFS had to make some compromise which go as follow:
> -+ - When SWAP accounting isn't enabled, no SWAP space is reported at all.
> -+   This is simply because there is no way to know the SWAP consumption.
> -+   The container may very much be using some SWAP though, there's just
> -+   no way to know how much of it and showing a SWAP device would require
> -+   some kind of SWAP usage to be reported. Showing the host value would be
> -+   completely wrong, showing a 0 value would be equallty wrong.
> -+
> -+ - Because SWAP usage for a given container can exceed the delta between
> -+   RAM and RAM+SWAP, the SWAP size is always reported to be the smaller of
> -+   the RAM+SWAP limit or the host SWAP device itself. This ensures that at no
> -+   point SWAP usage will be allowed to exceed the SWAP size.
> -+
> -+ - If the swappiness is set to 0 and there is no SWAP usage, no SWAP is reported.
> -+   However if there is SWAP usage, then a SWAP device of the size of the
> -+   usage (100% full) is reported. This provides adequate reporting of
> -+   the memory consumption while preventing applications from assuming more
> -+   SWAP is available.
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0003-cgroups-Add-get_memory_swappiness.patch b/debian/patches/pve/0003-cgroups-Add-get_memory_swappiness.patch
> deleted file mode 100644
> index 0bfdf81..0000000
> --- a/debian/patches/pve/0003-cgroups-Add-get_memory_swappiness.patch
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -From 5fb18e7b8ab9ee0b1af375aa13135cf0dfe30874 Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:17:02 -0500
> -Subject: [PATCH lxcfs 3/8] cgroups: Add get_memory_swappiness
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/cgroups/cgfsng.c | 7 +++++++
> - src/cgroups/cgroup.h | 2 ++
> - 2 files changed, 9 insertions(+)
> -
> -diff --git a/src/cgroups/cgfsng.c b/src/cgroups/cgfsng.c
> -index 824b0e7..d772f25 100644
> ---- a/src/cgroups/cgfsng.c
> -+++ b/src/cgroups/cgfsng.c
> -@@ -620,6 +620,12 @@ static int cgfsng_get_memory_max(struct cgroup_ops *ops, const char *cgroup,
> - 	return cgfsng_get_memory(ops, cgroup, "memory.max", value);
> - }
> - 
> -+static int cgfsng_get_memory_swappiness(struct cgroup_ops *ops, const char *cgroup,
> -+				 char **value)
> -+{
> -+	return cgfsng_get_memory(ops, cgroup, "memory.swappiness", value);
> -+}
> -+
> - static int cgfsng_get_memory_swap_max(struct cgroup_ops *ops,
> - 				      const char *cgroup, char **value)
> - {
> -@@ -1011,6 +1017,7 @@ struct cgroup_ops *cgfsng_ops_init(void)
> - 	cgfsng_ops->get_memory_stats_fd = cgfsng_get_memory_stats_fd;
> - 	cgfsng_ops->get_memory_stats = cgfsng_get_memory_stats;
> - 	cgfsng_ops->get_memory_max = cgfsng_get_memory_max;
> -+	cgfsng_ops->get_memory_swappiness = cgfsng_get_memory_swappiness;
> - 	cgfsng_ops->get_memory_swap_max = cgfsng_get_memory_swap_max;
> - 	cgfsng_ops->get_memory_current = cgfsng_get_memory_current;
> - 	cgfsng_ops->get_memory_swap_current = cgfsng_get_memory_swap_current;
> -diff --git a/src/cgroups/cgroup.h b/src/cgroups/cgroup.h
> -index ad4a3ae..f4b5d19 100644
> ---- a/src/cgroups/cgroup.h
> -+++ b/src/cgroups/cgroup.h
> -@@ -151,6 +151,8 @@ struct cgroup_ops {
> - 				       const char *cgroup, char **value);
> - 	int (*get_memory_max)(struct cgroup_ops *ops, const char *cgroup,
> - 			      char **value);
> -+	int (*get_memory_swappiness)(struct cgroup_ops *ops, const char *cgroup,
> -+			      char **value);
> - 	int (*get_memory_swap_max)(struct cgroup_ops *ops, const char *cgroup,
> - 				   char **value);
> - 	bool (*can_use_swap)(struct cgroup_ops *ops);
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0004-swap-Fix-usage-reporting.patch b/debian/patches/pve/0004-swap-Fix-usage-reporting.patch
> deleted file mode 100644
> index ec9d936..0000000
> --- a/debian/patches/pve/0004-swap-Fix-usage-reporting.patch
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -From 205df44462530825ded3ffe3e2d6d68cb716287d Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:17:40 -0500
> -Subject: [PATCH lxcfs 4/8] swap: Fix usage reporting
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/proc_fuse.c | 2 +-
> - 1 file changed, 1 insertion(+), 1 deletion(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index 7bc1eb0..0ad21b9 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -407,7 +407,7 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 	if (swtotal > 0) {
> - 		l = snprintf(d->buf + total_len, d->size - total_len,
> - 			     "none%*svirtual\t\t%" PRIu64 "\t%" PRIu64 "\t0\n",
> --			     36, " ", swtotal, swfree);
> -+			     36, " ", swtotal, swusage);
> - 		total_len += l;
> - 	}
> - 
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0005-swap-Only-report-usage-when-swappiness-is-0.patch b/debian/patches/pve/0005-swap-Only-report-usage-when-swappiness-is-0.patch
> deleted file mode 100644
> index 9bf9d63..0000000
> --- a/debian/patches/pve/0005-swap-Only-report-usage-when-swappiness-is-0.patch
> +++ /dev/null
> @@ -1,102 +0,0 @@
> -From 4538af183c2f48563681f303c54cef0430741b83 Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:20:26 -0500
> -Subject: [PATCH lxcfs 5/8] swap: Only report usage when swappiness is 0
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/proc_fuse.c | 28 ++++++++++++++++++++++++----
> - 1 file changed, 24 insertions(+), 4 deletions(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index 0ad21b9..002aac9 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -318,13 +318,14 @@ static inline bool startswith(const char *line, const char *pref)
> - static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 			   struct fuse_file_info *fi)
> - {
> --	__do_free char *cgroup = NULL, *memusage_str = NULL, *memswusage_str = NULL;
> -+	__do_free char *cgroup = NULL, *memusage_str = NULL,
> -+		 *memswusage_str = NULL, *memswpriority_str = NULL;
> - 	struct fuse_context *fc = fuse_get_context();
> - 	struct lxcfs_opts *opts = (struct lxcfs_opts *)fuse_get_context()->private_data;
> - 	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap();
> - 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
> - 	uint64_t memswlimit = 0, memlimit = 0, memusage = 0, memswusage = 0,
> --		 swtotal = 0, swfree = 0, swusage = 0;
> -+		 swtotal = 0, swfree = 0, swusage = 0, memswpriority = 1;
> - 	ssize_t total_len = 0;
> - 	ssize_t l = 0;
> - 	char *cache = d->buf;
> -@@ -380,6 +381,10 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 				if (swtotal >= swusage)
> - 					swfree = swtotal - swusage;
> - 			}
> -+
> -+			ret = cgroup_ops->get_memory_swappiness(cgroup_ops, cgroup, &memswpriority_str);
> -+			if (ret >= 0)
> -+				safe_uint64(memswpriority_str, &memswpriority, 10);
> - 		}
> - 	}
> - 
> -@@ -404,6 +409,11 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 		}
> - 	}
> - 
> -+	// When swappiness is 0, pretend we can't swap.
> -+	if (memswpriority == 0) {
> -+		swtotal = swusage;
> -+	}
> -+
> - 	if (swtotal > 0) {
> - 		l = snprintf(d->buf + total_len, d->size - total_len,
> - 			     "none%*svirtual\t\t%" PRIu64 "\t%" PRIu64 "\t0\n",
> -@@ -1136,7 +1146,7 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 			     struct fuse_file_info *fi)
> - {
> - 	__do_free char *cgroup = NULL, *line = NULL, *memusage_str = NULL,
> --		       *memswusage_str = NULL;
> -+		       *memswusage_str = NULL, *memswpriority_str = NULL;
> - 	__do_free void *fopen_cache = NULL;
> - 	__do_fclose FILE *f = NULL;
> - 	struct fuse_context *fc = fuse_get_context();
> -@@ -1144,7 +1154,8 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap(), host_swap = false;
> - 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
> - 	uint64_t memlimit = 0, memusage = 0, memswlimit = 0, memswusage = 0,
> --		 hosttotal = 0, swfree = 0, swusage = 0, swtotal = 0;
> -+		 hosttotal = 0, swfree = 0, swusage = 0, swtotal = 0,
> -+		 memswpriority = 1;
> - 	struct memory_stat mstat = {};
> - 	size_t linelen = 0, total_len = 0;
> - 	char *cache = d->buf;
> -@@ -1209,6 +1220,10 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 					swusage = (memswusage - memusage) / 1024;
> - 			}
> - 		}
> -+
> -+		ret = cgroup_ops->get_memory_swappiness(cgroup_ops, cgroup, &memswpriority_str);
> -+		if (ret >= 0)
> -+			safe_uint64(memswpriority_str, &memswpriority, 10);
> - 	}
> - 
> - 	f = fopen_cached("/proc/meminfo", "re", &fopen_cache);
> -@@ -1257,6 +1272,11 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 					swtotal = hostswtotal;
> - 					host_swap = true;
> - 				}
> -+
> -+				/* When swappiness is 0, pretend we can't swap. */
> -+				if (memswpriority == 0) {
> -+					swtotal = swusage;
> -+				}
> - 			}
> - 
> - 			snprintf(lbuf, 100, "SwapTotal:      %8" PRIu64 " kB\n", swtotal);
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0006-swap-Tweak-meminfo-logic.patch b/debian/patches/pve/0006-swap-Tweak-meminfo-logic.patch
> deleted file mode 100644
> index 987af6c..0000000
> --- a/debian/patches/pve/0006-swap-Tweak-meminfo-logic.patch
> +++ /dev/null
> @@ -1,72 +0,0 @@
> -From 1e92c18e409f37f79a24f61623b9d9c4d84e3280 Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:30:27 -0500
> -Subject: [PATCH lxcfs 6/8] swap: Tweak meminfo logic
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/proc_fuse.c | 30 +++++++++---------------------
> - 1 file changed, 9 insertions(+), 21 deletions(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index 002aac9..4c555ec 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -1151,7 +1151,7 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 	__do_fclose FILE *f = NULL;
> - 	struct fuse_context *fc = fuse_get_context();
> - 	struct lxcfs_opts *opts = (struct lxcfs_opts *)fuse_get_context()->private_data;
> --	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap(), host_swap = false;
> -+	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap();
> - 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
> - 	uint64_t memlimit = 0, memusage = 0, memswlimit = 0, memswusage = 0,
> - 		 hosttotal = 0, swfree = 0, swusage = 0, swtotal = 0,
> -@@ -1258,19 +1258,14 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 
> - 				sscanf(line + STRLITERALLEN("SwapTotal:"), "%" PRIu64, &hostswtotal);
> - 
> --				/*
> --				 * If swtotal is 0 it should mean that
> --				 * memory.memsw.limit_in_bytes and
> --				 * memory.limit_in_bytes are both unlimited or
> --				 * both set to the same value. In both cases we
> --				 * have no idea what the technical swap limit
> --				 * is supposed to be (It's a shared limit
> --				 * anyway.) so fallback to the host's values in
> --				 * that case too.
> --				 */
> --				if ((hostswtotal < swtotal) || swtotal == 0) {
> -+				/* The total amount of swap is always reported to be the
> -+				   lesser of the RAM+SWAP limit or the SWAP device size.
> -+				   This is because the kernel can swap as much as it
> -+				   wants and not only up to swtotal. */
> -+
> -+				swtotal = memlimit + swtotal;
> -+				if (hostswtotal < swtotal) {
> - 					swtotal = hostswtotal;
> --					host_swap = true;
> - 				}
> - 
> - 				/* When swappiness is 0, pretend we can't swap. */
> -@@ -1283,14 +1278,7 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
> - 			printme = lbuf;
> - 		} else if (startswith(line, "SwapFree:")) {
> - 			if (wants_swap) {
> --				uint64_t hostswfree = 0;
> --
> --				if (host_swap) {
> --					sscanf(line + STRLITERALLEN("SwapFree:"), "%" PRIu64, &hostswfree);
> --					swfree = hostswfree;
> --				} else if (swtotal >= swusage) {
> --					swfree = swtotal - swusage;
> --				}
> -+				swfree = swtotal - swusage;
> - 			}
> - 
> - 			snprintf(lbuf, 100, "SwapFree:       %8" PRIu64 " kB\n", swfree);
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0007-swap-Make-proc-swaps-match-proc-meminfo.patch b/debian/patches/pve/0007-swap-Make-proc-swaps-match-proc-meminfo.patch
> deleted file mode 100644
> index 07945e2..0000000
> --- a/debian/patches/pve/0007-swap-Make-proc-swaps-match-proc-meminfo.patch
> +++ /dev/null
> @@ -1,89 +0,0 @@
> -From a46b7b6978867101e79db1e1a51d30f2a02176ec Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:43:01 -0500
> -Subject: [PATCH lxcfs 7/8] swap: Make /proc/swaps match /proc/meminfo
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/proc_fuse.c | 47 ++++++++++++++++++++++++++++-------------------
> - 1 file changed, 28 insertions(+), 19 deletions(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index 4c555ec..fc69789 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -325,11 +325,16 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap();
> - 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
> - 	uint64_t memswlimit = 0, memlimit = 0, memusage = 0, memswusage = 0,
> --		 swtotal = 0, swfree = 0, swusage = 0, memswpriority = 1;
> -+		 swtotal = 0, swfree = 0, swusage = 0, memswpriority = 1
> -+		 hostswtotal = 0, hostswfree = 0;
> - 	ssize_t total_len = 0;
> - 	ssize_t l = 0;
> - 	char *cache = d->buf;
> - 	int ret;
> -+	__do_free char *line = NULL;
> -+	__do_free void *fopen_cache = NULL;
> -+	__do_fclose FILE *f = NULL;
> -+	size_t linelen = 0;
> - 
> - 	if (offset) {
> - 		int left;
> -@@ -390,28 +395,32 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 
> - 	total_len = snprintf(d->buf, d->size, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
> - 
> --	/* When no mem + swap limit is specified or swapaccount=0*/
> --	if (!memswlimit) {
> --		__do_free char *line = NULL;
> --		__do_free void *fopen_cache = NULL;
> --		__do_fclose FILE *f = NULL;
> --		size_t linelen = 0;
> -+	/* Read host total and free values */
> -+	f = fopen_cached("/proc/meminfo", "re", &fopen_cache);
> -+	if (!f)
> -+		return 0;
> - 
> --		f = fopen_cached("/proc/meminfo", "re", &fopen_cache);
> --		if (!f)
> --			return 0;
> -+	while (getline(&line, &linelen, f) != -1) {
> -+		if (startswith(line, "SwapTotal:"))
> -+			sscanf(line, "SwapTotal:      %8" PRIu64 " kB", &hostswtotal);
> -+		else if (startswith(line, "SwapFree:"))
> -+			sscanf(line, "SwapFree:      %8" PRIu64 " kB", &hostswfree);
> -+	}
> - 
> --		while (getline(&line, &linelen, f) != -1) {
> --			if (startswith(line, "SwapTotal:"))
> --				sscanf(line, "SwapTotal:      %8" PRIu64 " kB", &swtotal);
> --			else if (startswith(line, "SwapFree:"))
> --				sscanf(line, "SwapFree:      %8" PRIu64 " kB", &swfree);
> -+	if (wants_swap) {
> -+		/* The total amount of swap is always reported to be the
> -+		   lesser of the RAM+SWAP limit or the SWAP device size.
> -+		   This is because the kernel can swap as much as it
> -+		   wants and not only up to swtotal. */
> -+		swtotal = memlimit / 1024 + swtotal;
> -+		if (hostswtotal < swtotal) {
> -+			swtotal = hostswtotal;
> - 		}
> --	}
> - 
> --	// When swappiness is 0, pretend we can't swap.
> --	if (memswpriority == 0) {
> --		swtotal = swusage;
> -+		/* When swappiness is 0, pretend we can't swap. */
> -+		if (memswpriority == 0) {
> -+			swtotal = swusage;
> -+		}
> - 	}
> - 
> - 	if (swtotal > 0) {
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/pve/0008-swap-Remove-now-unused-variable.patch b/debian/patches/pve/0008-swap-Remove-now-unused-variable.patch
> deleted file mode 100644
> index e9a75eb..0000000
> --- a/debian/patches/pve/0008-swap-Remove-now-unused-variable.patch
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -From 1d3a4a0dd7411d34f10e47c1d850213a63a3581e Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
> -Date: Thu, 5 Nov 2020 15:46:07 -0500
> -Subject: [PATCH lxcfs 8/8] swap: Remove now unused variable
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ----
> - src/proc_fuse.c | 4 +---
> - 1 file changed, 1 insertion(+), 3 deletions(-)
> -
> -diff --git a/src/proc_fuse.c b/src/proc_fuse.c
> -index fc69789..9bf963b 100644
> ---- a/src/proc_fuse.c
> -+++ b/src/proc_fuse.c
> -@@ -325,7 +325,7 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 	bool wants_swap = opts && !opts->swap_off && liblxcfs_can_use_swap();
> - 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
> - 	uint64_t memswlimit = 0, memlimit = 0, memusage = 0, memswusage = 0,
> --		 swtotal = 0, swfree = 0, swusage = 0, memswpriority = 1
> -+		 swtotal = 0, swusage = 0, memswpriority = 1,
> - 		 hostswtotal = 0, hostswfree = 0;
> - 	ssize_t total_len = 0;
> - 	ssize_t l = 0;
> -@@ -383,8 +383,6 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
> - 					swusage = 0;
> - 				else
> - 					swusage = (memswusage - memusage) / 1024;
> --				if (swtotal >= swusage)
> --					swfree = swtotal - swusage;
> - 			}
> - 
> - 			ret = cgroup_ops->get_memory_swappiness(cgroup_ops, cgroup, &memswpriority_str);
> --- 
> -2.20.1
> -
> diff --git a/debian/patches/series b/debian/patches/series
> index b4bddb8..bf650b4 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -1,9 +1 @@
>  do-not-start-without-lxcfs.patch
> -pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
> -pve/0002-README-clarify-SWAP.patch
> -pve/0003-cgroups-Add-get_memory_swappiness.patch
> -pve/0004-swap-Fix-usage-reporting.patch
> -pve/0005-swap-Only-report-usage-when-swappiness-is-0.patch
> -pve/0006-swap-Tweak-meminfo-logic.patch
> -pve/0007-swap-Make-proc-swaps-match-proc-meminfo.patch
> -pve/0008-swap-Remove-now-unused-variable.patch
> diff --git a/lxcfs b/lxcfs
> index db61421..725e90b 160000
> --- a/lxcfs
> +++ b/lxcfs
> @@ -1 +1 @@
> -Subproject commit db61421bf1a847f39d404f7acc2cbeb6fba89eae
> +Subproject commit 725e90b5d67e264ee4a7ff0851c79728feab1da8
> 





More information about the pve-devel mailing list