Skip to content

u/chrisdown

In this archive from Aug 2012 to Aug 2023

2
posts
45
comments
1
media
622
score

The "single letter variables" in dwm are perfectly logical and understandable. For example:

  • a: an Arg
  • c: an arbitrary Client
  • m: an arbitrary Monitor

...not exactly rocket science. Where more context about the purpose of a specific object is needed, there are clarifications like selmon->sel. dwm is a very straightforward codebase to get started with as a new contributor, as long as you know C (and Xlib).

If you have suggestions for function naming improvements you're welcome to submit a patch. I'm not convinced that there's much wrong with the existing names though.

dwm's codebase isn't perfect and it may not be very shiny or written in the latest chic language, but calling it "awful" is amusing.

6 points

Not sure if you noticed, but since I'm also a maintainer of the oomd project, I felt compelled to already write a note in the readme about the relation of the two :-)

oomd and psi-notify are two compatible and complementary projects -- they're not in opposition to each other. oomd also uses PSI metrics, but it requires a policy about "what to kill" in high-pressure scenarios. For example, on a web server we obviously don't want to kill the web server if we can avoid that, so we should prioritise other applications. On the desktop though, it's hard to say: should we kill Chrome, or some IDE, or maybe something playing a movie? It's extremely difficult (although perhaps possible) to produce a single configuration that will do the right thing in even the majority of cases, so we opt to alert early instead and have the user make the decision about what's high priority in their user session. When integrating oomd for the desktop, most distributions will likely end up having to make it less aggressive than would be ideal, so they can still interoperate.

It's hard to produce a good policy for, say, one's working day, where at one time my terminal is the most critical thing, at another my browser is, and at another it's my mail client. At other times maybe I'm ok with the slowdown and am willing to ride it out without killing anything. psi-notify sidesteps this problem by simply notifying, rather than taking action.

3 points

Thanks, and sure, I can see where you're coming from. There are definitely tradeoffs in both directions, but there are a few nice things about having everything in one file for small projects (let's say <1000 lines):

  • Ease of navigation. People don't have to worry about ctags, an IDE or whatever to find things quickly. They know that if it's provided by this project, it's in this file.
  • Reduction of Makefile complexity and dependency knowledge. Ok, so it doesn't add a whole lot more work to add some more objects to the mix in the Makefile, but I also don't see much reason to add them, either.
  • I'm not convinced splitting into more files makes things much clearer. If I were to do this, we'd probably end up with five files: notify.[ch], psi.[ch], and maybe cli.c. I'm not sure that really achieves much, which functions are part of which of these is already pretty clear.

psi-notify is fundamentally pretty simple in concept. If you trace through main(), I think you'll get there pretty fast :-)

All the functions pretty much do what they say they do:

% ctags -x psi-notify.c | awk '$2 == "function" { print $1 }'                 
alert_destroy
alert_destroy_all_active
alert_stop
alert_user
alert_user_if_new
config_init
config_reset_user_facing
config_update_from_file
configure_signal_handlers
get_pressure_file
is_blank
main
pressure_check
pressure_check_notify_if_new
pressure_check_single_line
request_exit
request_reload_config
threshold_update
watchdog_update_usec
9 points

Hey! I actually work full time on Linux memory management and am one of the cgroup maintainers, so I'm pretty well versed in in this area. :-)

While it's true we're not bad at distributing resources, the question is about what to do when there is a scarcity of resources, and that's what PSI helps with -- identifying those scarcities as they start to occur and allowing some application or user to do something about it.

Low latency kernels are unlikely to help in these scenarios, because this isn't about latency or throughput, but instead actual resource shortages. That's what PSI has been designed to identify.

You can find out more about why PSI is useful in my talk at SREcon last year. Discussion of PSI is around the 25 minute mark: https://www.youtube.com/watch?v=beefUhRH5lU&feature=youtu.be&t=1505

17 points

On the AUR: https://aur.archlinux.org/packages/psi-notify/

Posting here in particular since this uses some pretty new kernel features (specifically PSI, which is enabled in the default Arch kernel) that I think will be of interest to Arch Linux users. :-)

I think we've all had situations where the desktop environment has become so slow as to be unusable, usually because some application has started eating up system resources quickly. Fellow Chrome users, I'm especially looking at you.

My wife is certainly someone in that position. Often she gets into scenarios where unwieldy applications like Chrome would unexpectedly eat memory over time, eventually ending with her desktop suddenly slowing to a crawl. Usually the only way out of this situation is to manually trigger an OOM kill with Alt + SysRq + F, and even then that's not foolproof, since the OOM killer may not pick the right target to kill. Even if it does pick the right target to kill, system responsiveness after the fact can still be impacted since the thrashing has pushed many pages into swap.

Logging PSI metrics on her machine leading up to these incidents, it was pretty obvious that there was always an opportunity to alert her ahead of time that the situation was becoming a problem, and allow her to manually select which applications to kill, since it might not always just be the one using the most memory or with the highest memory usage in a desktop scenario. Since prioritisation of "what to kill" is so dynamic on the desktop, it's very hard to write a one-size-fits-all policy about what to do in these scenarios, so these notifications allow you to avoid that problem entirely.

To that extent, psi-notify will warn you using whatever desktop notifier you have running (eg. GNOME notifications, dunst, xfce4-notifyd) when resources are starting to become contended, so that you can do something about that. A facetious demo is shown in the readme.

Feature requests and bug reports are welcome. I've been using it for the last week and already found it useful in keeping death-by-Chrome at bay. :-)

43 points

Presumably because groups are quite fragile and don't integrate very well in the current libalpm design. For example, there's no tracking of the fact that a package was installed due to being part of a group, and there's no single way to keep a group in sync -- for example, expunging removed members of a group, and installing new members of a group on upgrade. Sure, you can hack around this, but it's not really that well supported.

However, I am concerned that this is being done while base is still so large. We have tons of stuff in there that most people are simply never going to use (reiserfsprogs and jfsutils perhaps being two of the most obvious examples). It would be nice to have a targeted drive to reduce the size of base and base-devel.

84 points

Others already went over capacity udev events, so I'll not go into that. For just AC/battery however, I wrote a post about hooking these up to systemd targets a while back, in case it's helpful: https://chrisdown.name/2017/10/29/adding-power-related-targets-to-systemd.html

In my experience, this is more flexible than changing udev rules every time you want to add something new. :-)

1 points

I think this may somehow be a race between mounting and setting up swap.

This is a successful boot:

Jan 23 00:04:56 xiaoqiao systemd[1]: Found device TOSHIBA_THNSFJ256GDNU_A Swap.
Jan 23 00:04:56 xiaoqiao systemd[1]: Starting Cryptography Setup for swap...
Jan 23 00:04:56 xiaoqiao systemd[1]: Started Cryptography Setup for swap.
Jan 23 00:04:56 xiaoqiao mkswap[543]: Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
Jan 23 00:04:56 xiaoqiao mkswap[543]: no label, UUID=825e2b75-8419-4044-9ac5-e2a6eba4c3d6
Jan 23 00:04:56 xiaoqiao systemd[1]: Found device /dev/mapper/swap.
Jan 23 00:04:56 xiaoqiao systemd[1]: Activating swap /dev/mapper/swap...
Jan 23 00:04:56 xiaoqiao kernel: Adding 2097148k swap on /dev/mapper/swap.  Priority:-2 extents:1 across:2097148k SSFS
Jan 23 00:04:56 xiaoqiao systemd[1]: Activated swap /dev/mapper/swap.
Jan 23 00:04:56 xiaoqiao systemd[1]: Reached target Swap.

On an unsuccessful boot:

Jan 22 23:45:52 xiaoqiao systemd[1]: Found device TOSHIBA_THNSFJ256GDNU_A Swap.
Jan 22 23:45:52 xiaoqiao systemd[1]: Starting Cryptography Setup for swap...
Jan 22 23:45:53 xiaoqiao mkswap[519]: Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
Jan 22 23:45:53 xiaoqiao mkswap[519]: no label, UUID=d1d2c3fa-9238-4539-9f8f-94a0f677d187
Jan 22 23:45:53 xiaoqiao systemd[1]: Started Cryptography Setup for swap.

Notice the change in the order of mkswap and systemd-cryptsetup@swap.service. It seems that mkswap comes from systemd-cryptsetup@swap.service's ExecStartPost:

xiaoqiao % systemctl cat systemd-cryptsetup@swap.service | grep mkswap
ExecStartPost=/sbin/mkswap '/dev/mapper/swap'

Then again, it has Before=dev-mapper-%i.swap, so I'm not sure what to think.

As a workaround, I suspect this should work, and I'm trying it out with success so far (swap will just not be enabled if it fails):

# /etc/systemd/system/dev-mapper-swap.swap.d/override.conf
[Swap]
TimeoutSec=5
3 points

This is something we (cgroup v2 team) have been working on as part of our goal to improve Linux resource contention metrics, in the form of pressure measurement. You can find some information about PSI (specifically, memory PSI) in my talk here: https://youtu.be/ikZ8_mRotT4?t=2145

We also have a more high level overview of the overall system here: https://facebookmicrosites.github.io/psi/

3 points

I run Arch Linux in a 300+ server fleet. In my main job (part of a small team responsible for 100,000+ physical servers running CentOS) I encounter a significant deal more pain backporting intrusive bug fixes.

Staged rollouts are a thing you need to do with a large fleet no matter what distribution you use. If your company needs support or explicit SLAs though... that's a separate problem. I mean, the solution to that is to hire someone to work on your OS infrastructure, which is a big win in the long term.

9 points

For the former point, I really don't think that Arch is much worse than anyone else. If you take your infrastructure seriously, you have to stage rollouts and upgrades gradually no matter what distribution you use -- there have been plenty of breakages in Debian and CentOS in the past without a major release, too.

The support angle is much more compelling. Big companies expect that their priorities can become your priorities, and Arch definitely isn't in any place (or mindset) to offer such a thing.

2 points

New kernels and other packages in the core repo are added to the testing repo first, so that people can exercise and check the kernels and other core system utilities are working across a diverse range of hardware on Arch. 4.10 isn't there yet (4.9.11 is), but it will be built shortly.

The reason for this is historic, see this update for one of the incidents that led to this structure being put in place.

If you want to be once of the first testers for 4.10 in Arch, enabling the testing repo is the way to go. Instructions here: https://wiki.archlinux.org/index.php/Official_repositories#testing

10 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

โ†orโ†’
Previous / next file
โ†‘orโ†“
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.