You are not logged in.

#1 2021-09-01 21:11:17

mocambo
Member
Registered: 2017-09-24
Posts: 27

[solved] Allocated swap size is wrong:

Hello !

When attempted to solve the "Not enough free memory" hibernation problem, I discovered, that swap space in my machine is just 2Gb instead of 4Gb, assigned for swap partition.

Kernel gives a message: "kernel: Truncating oversized swap area, only using 2097152k out of 4177916k". Here I found a solution to use different kernel. But both current linux and linux-zen seems to be affected. On the same time kernel reports, there is no mitigation for L1TF.
https://unix.stackexchange.com/question … -60k-issue

Any ideas ?

Thank you in advance !

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 111.8G  0 disk 
├─sda1   8:1    0     8M  0 part 
├─sda2   8:2    0    20G  0 part /
├─sda3   8:3    0     4G  0 part [SWAP]
└─sda4   8:4    0  87.8G  0 part /home
sr0     11:0    1  1024M  0 rom  
# cat /proc/swaps
Filename				Type		Size		Used		Priority
/dev/sda3                               partition	2097148		760912		-2
# journalctl -b0
Sep 01 22:56:04 archlinux kernel: L1TF: Kernel not compiled for PAE. No mitigation for L1TF
...
Sep 01 22:56:04 archlinux kernel: Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
Sep 01 22:56:05 archlinux kernel: zswap: loaded using pool lz4/z3fold
Sep 01 22:56:13 archlinux systemd[1]: Activating swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda...
Sep 01 22:56:13 archlinux kernel: Truncating oversized swap area, only using 2097152k out of 4177916k
Sep 01 22:56:13 archlinux kernel: Adding 2097148k swap on /dev/sda3.  Priority:-2 extents:1 across:2097148k SSDscFS
Sep 01 22:56:13 archlinux systemd[1]: Activated swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda.
...
Sep 01 18:45:39 archlinux kernel: PM: hibernation: hibernation entry
Sep 01 18:46:01 archlinux kernel: Filesystems sync: 0.127 seconds
Sep 01 18:46:01 archlinux kernel: Freezing user space processes ... (elapsed 0.008 seconds) done.
Sep 01 18:46:01 archlinux kernel: OOM killer disabled.
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Marking nosave pages: [mem 0x0009f000-0x000fffff]
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Basic memory bitmaps created
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Preallocating image memory
Sep 01 18:46:01 archlinux kernel: warn_alloc: 3469 callbacks suppressed
Sep 01 18:46:01 archlinux kernel: kworker/u2:0: page allocation failure: order:0, mode:0xc00(GFP_NOIO), nodemask=(null),cpuset=/,mems_allowed=0
Sep 01 18:46:01 archlinux kernel: CPU: 0 PID: 29433 Comm: kworker/u2:0 Tainted: G        W         5.12.15-zen1-1.0-zen-zen #1
Sep 01 18:46:01 archlinux kernel: Hardware name: By O.E.M R15D/To Be Filled By O.E.M., BIOS 080011  09/18/2006
Sep 01 18:46:01 archlinux kernel: Workqueue: evenreezreez_pow_power_ disk_events_workfn
Sep 01 18:46:01 archlinux kernel: Call Trace:
Sep 01 18:46:01 archlinux kernel:  dump_stack+0x5f/0x78
Sep 01 18:46:01 archlinux kernel:  warn_alloc.cold+0x52/0xac
Sep 01 18:46:01 archlinux kernel:  __alloc_pages_nodemask+0xeb0/0xed0
Sep 01 18:46:01 archlinux kernel:  blk_rq_map_kern+0x12f/0x450
Sep 01 18:46:01 archlinux kernel:  ? blk_mq_alloc_request+0x68/0xb0
Sep 01 18:46:01 archlinux kernel:  __scsi_execute+0x19d/0x1e0
Sep 01 18:46:01 archlinux kernel:  sr_check_events+0xb1/0x2c0 [sr_mod]
Sep 01 18:46:01 archlinux kernel:  ? sr_packet+0x50/0x50 [sr_mod]
Sep 01 18:46:01 archlinux kernel:  cdrom_check_events+0x1d/0x40 [cdrom]
Sep 01 18:46:01 archlinux kernel:  sr_block_check_events+0xda/0x190 [sr_mod]
Sep 01 18:46:01 archlinux kernel:  ? sr_block_release+0x90/0x90 [sr_mod]
Sep 01 18:46:01 archlinux kernel:  disk_check_events+0x4a/0x140
Sep 01 18:46:01 archlinux kernel:  disk_events_workfn+0x15/0x20
Sep 01 18:46:01 archlinux kernel:  process_one_work+0x1ff/0x3a0
Sep 01 18:46:01 archlinux kernel:  worker_thread+0x150/0x4c0
Sep 01 18:46:01 archlinux kernel:  kthread+0x163/0x190
Sep 01 18:46:01 archlinux kernel:  ? process_one_work+0x3a0/0x3a0
Sep 01 18:46:01 archlinux kernel:  ? kthread_unuse_mm+0x90/0x90
Sep 01 18:46:01 archlinux kernel:  ret_from_fork+0x1c/0x28
Sep 01 18:46:01 archlinux kernel: Mem-Info:
Sep 01 18:46:01 archlinux kernel: active_anon:15256 inactive_anon:73142 isolated_anon:64
                                   active_file:426 inactive_file:22344 isolated_file:0
                                   unevictable:2230 dirty:0 writeback:0
                                   slab_reclaimable:5142 slab_unreclaimable:17326
                                   mapped:28290 shmem:8414 pagetables:2127 bounce:0
                                   free:11029 free_pcp:173 free_cma:0
Sep 01 18:46:01 archlinux kernel: Node 0 active_anon:61024kB inactive_anon:292568kB active_file:1704kB inactive_file:89376kB unevictable:8920kB isolated(anon):256kB isolated(file):0kB mapped:113160kB dirty:0kB writeba>
Sep 01 18:46:01 archlinux kernel: DMA free:3984kB min:760kB low:948kB high:1136kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15>
Sep 01 18:46:01 archlinux kernel: lowmem_reserve[]: 0 809 1945 1945
Sep 01 18:46:01 archlinux kernel: Normal free:39808kB min:41196kB low:51492kB high:61788kB reserved_highatomic:0KB active_anon:24kB inactive_anon:140kB active_file:500kB inactive_file:20kB unevictable:0kB writepending>
Sep 01 18:46:01 archlinux kernel: lowmem_reserve[]: 0 0 9086 9086
Sep 01 18:46:01 archlinux kernel: HighMem free:324kB min:512kB low:14952kB high:29392kB reserved_highatomic:0KB active_anon:61000kB inactive_anon:292428kB active_file:1192kB inactive_file:89368kB unevictable:8920kB wr>
Sep 01 18:46:01 archlinux kernel: lowmem_reserve[]: 0 0 0 0
Sep 01 18:46:01 archlinux kernel: DMA: 2*4kB (U) 2*8kB (U) 4*16kB (UM) 2*32kB (UM) 2*64kB (M) 1*128kB (U) 2*256kB (UM) 0*512kB 1*1024kB (M) 1*2048kB (M) 0*4096kB = 3992kB
Sep 01 18:46:01 archlinux kernel: Normal: 4742*4kB (UME) 1691*8kB (ME) 357*16kB (UM) 48*32kB (UM) 1*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 39808kB
Sep 01 18:46:01 archlinux kernel: HighMem: 81*4kB (M) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 324kB
Sep 01 18:46:01 archlinux kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=4096kB
Sep 01 18:46:01 archlinux kernel: 37222 total pagecache pages
Sep 01 18:46:01 archlinux kernel: 6053 pages in swap cache
Sep 01 18:46:01 archlinux kernel: Swap cache stats: add 6866849, delete 6860800, find 1840491/3110172
Sep 01 18:46:01 archlinux kernel: Free swap  = 1061292kB
Sep 01 18:46:01 archlinux kernel: Total swap = 2097148kB
Sep 01 18:46:01 archlinux kernel: 515950 pages RAM
Sep 01 18:46:01 archlinux kernel: 290770 pages HighMem/MovableOnly
Sep 01 18:46:01 archlinux kernel: 10458 pages reserved
Sep 01 18:46:01 archlinux kernel: 0 pages cma reserved
Sep 01 18:46:01 archlinux kernel: 0 pages hwpoisoned
Sep 01 18:46:01 archlinux kernel: slab_out_of_memory: 3456 callbacks suppressed
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: SLUB: Unable to allocate memory on node -1, gfp=0xcc0(GFP_KERNEL)
Sep 01 18:46:01 archlinux kernel:   cache: vmap_area, object size: 32, buffer size: 32, default order: 0, min order: 0
Sep 01 18:46:01 archlinux kernel:   node 0: slabs: 2249, objs: 287872, free: 0
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Allocated 145211 pages for snapshot
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Allocated 580844 kbytes in 19.12 seconds (30.37 MB/s)
Sep 01 18:46:01 archlinux kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Sep 01 18:46:01 archlinux kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Sep 01 18:46:01 archlinux kernel: serial 00:05: disabled
Sep 01 18:46:01 archlinux kernel: wlp1s4: Going into suspend...
Sep 01 18:46:01 archlinux kernel: ACPI: EC: interrupt blocked
Sep 01 18:46:01 archlinux kernel: Disabling non-boot CPUs ...
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Creating image:
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Need to copy 144817 pages
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Normal pages needed: 138851 + 1024, available pages: 86292
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Not enough free memory
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Error -12 creating image
Sep 01 18:46:01 archlinux kernel: Force enabled HPET at resume
Sep 01 18:46:01 archlinux kernel: ACPI: EC: interrupt unblocked
Sep 01 18:46:01 archlinux kernel: yenta_cardbus 0000:01:05.0: O2: enabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=off'
Sep 01 18:46:01 archlinux kernel: wlp1s4: Coming out of suspend...
Sep 01 18:46:01 archlinux kernel: serial 00:05: activated
Sep 01 18:46:01 archlinux kernel: ata5.00: ACPI cmd ef/03:42:00:00:00:a0 (SET FEATURES) filtered out
Sep 01 18:46:01 archlinux kernel: ata5.00: ACPI cmd ef/03:0c:00:00:00:a0 (SET FEATURES) filtered out
Sep 01 18:46:01 archlinux kernel: ata3: SATA link down (SStatus 0 SControl 300)
Sep 01 18:46:01 archlinux kernel: ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
Sep 01 18:46:01 archlinux kernel: ata1.00: configured for UDMA/133
Sep 01 18:46:01 archlinux kernel: firewire_core 0000:01:05.4: rediscovered device fw0
Sep 01 18:46:01 archlinux kernel: PM: hibernation: Basic memory bitmaps freed
Sep 01 18:46:01 archlinux kernel: OOM killer enabled.
Sep 01 18:46:01 archlinux kernel: Restarting tasks ... done.
Sep 01 18:46:01 archlinux kernel: PM: hibernation: hibernation exit
Sep 01 18:46:01 archlinux kernel: audit: type=1131 audit(1630511161.417:891): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? add>
Sep 01 18:46:01 archlinux audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Sep 01 18:46:00 archlinux rtkit-daemon[878]: The canary thread is apparently starving. Taking action.
Sep 01 18:46:01 archlinux systemd-resolved[347]: Clock change detected. Flushing caches.
Sep 01 18:46:00 archlinux rtkit-daemon[878]: Demoting known real-time threads.
Sep 01 18:46:01 archlinux systemd-sleep[29534]: Failed to suspend system. System resumed again: Cannot allocate memory

Last edited by mocambo (2021-09-02 15:24:42)

Offline

#2 2021-09-01 22:36:43

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 1,197

Re: [solved] Allocated swap size is wrong:

That kernel log seems to suggest the swap areas is only 4177916k whereas by my maths 4GiB should be 4194304kiB, or even slightly more if I assume a kilobyte is only 1000 bytes.  I'm not sure why what lsblk reports differs from what the kernel thinks.  Makes me wonder if you remembered to clear out the swap space before mkswapping it, in case it had previously allocated data inside which caused mkswap not not allocate the full partition.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#3 2021-09-02 05:19:55

deep42thought
Administrator
From: Jena, Germany
Registered: 2017-06-17
Posts: 617

Re: [solved] Allocated swap size is wrong:

There are certain limits with 32 bit machines at 2 and 4GB respectively. I don't know of any specific one for the swap, but you may try the linux-pae kernel (if that boots for you), which circumvents some of these limits.

Offline

#4 2021-09-02 12:43:32

mocambo
Member
Registered: 2017-09-24
Posts: 27

Re: [solved] Allocated swap size is wrong:

Thanks for answers !

I digged into previous boot logs and it seems that the problem started when I moved from Manjaro to Archlinux32 repositories. The newer kernel seems to have somekind of threat mitigation limitation "Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization". Any ideas ?

Last Manjaro boot:

# journalctl -b -47
Apr 06 23:08:49 Twinhead kernel: Linux version 4.14.114-1-MANJARO (builder@621d482cdfbe) (gcc version 8.3.0 (GCC)) #1 SMP PREEMPT Sat Apr 27 13:40:44 UTC 2019
...
Apr 06 23:08:50 Twinhead kernel: zswap: loaded using pool lzo/zbud
Apr 06 23:08:54 Twinhead systemd[1]: Activating swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda...
Apr 06 23:08:55 Twinhead kernel: Adding 4177916k swap on /dev/sda3.  Priority:-2 extents:1 across:4177916k SSDscFS
Apr 06 23:08:55 Twinhead systemd[1]: Activated swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda.

First Archlinux32 boot:

# journalctl -b -46
Apr 07 23:38:57 archlinux kernel: Linux version 5.11.10-arch1-1.0 (linux@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Sat, 27 Mar 2021 21:02:14 +0000
...
Apr 07 23:38:57 archlinux kernel: Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
Apr 07 23:38:58 archlinux kernel: zswap: loaded using pool lz4/z3fold
Apr 07 23:39:06 archlinux systemd[1]: Activating swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda...
Apr 07 23:39:06 archlinux kernel: Truncating oversized swap area, only using 2097152k out of 4177916k
Apr 07 23:39:06 archlinux kernel: Adding 2097148k swap on /dev/sda3.  Priority:-2 extents:1 across:2097148k SSDscFS
Apr 07 23:39:07 archlinux systemd[1]: Activated swap /dev/disk/by-uuid/6d1295c6-f09b-4f29-be26-b6d1c6aebbda.

Offline

#5 2021-09-02 15:01:57

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 1,197

Re: [solved] Allocated swap size is wrong:

Presumably you're running a later CPU than I've got.  According to my system, I'm not affected by l1tf or spectre on this CPU because presumably it's one of the last in order processors intel produced.  Given yours is later, I suspect it's capable or running 64bit code just fine.

That said, it's not immediately obvious to me why mitigations to spectre and so on would crop your swap.  I thought most of the trampolines would add boiler plate code to function calls, and I don't see how that would affect your swap space other than the code you're swapping out being slightly more crusty.  But I'm probably just slightly out of date in the understanding of all these mitigations, because to be honest I lost interest in all this stuff about a year ago.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#6 2021-09-02 15:23:59

mocambo
Member
Registered: 2017-09-24
Posts: 27

Re: [solved] Allocated swap size is wrong:

OK. Adding boot parameter "mitigations=off" helped me out this time. Swap space is back 4Gb (almost smile).
Thank you for thinking along !

Offline

#7 2021-09-02 15:55:30

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 1,031
Website

Re: [solved] Allocated swap size is wrong:

The trunc size 2097152k sounds suspiciously like 2^31/1024, which is a 2 unsigned int 32-bit limit. :-)
But I remember vividely having machines with a modern kernel and 4 GB of RAM.. puzzling, really..

Offline

#8 2021-09-02 22:24:18

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 1,197

Re: [solved] Allocated swap size is wrong:

2^31/1024 is the maximum number of signed 32-bit numbers if you're counting bytes but reporting back in kibibytes.
2^32/1024 should be the maximum for unsigned 32-bit numbers, I'd have thought, unless my maths is completely out of kilter.  Yes, 32-bit numbers count up to bit 31 but they start counting at bit 0 so there's 32 bits there.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

Board footer

Powered by FluxBB