Re: An idea for swap partition size vs. swap space size in use handling

2023-01-21 Thread Poul-Henning Kamp

Mark Millard writes:

> It would be nice if I could have just one swap partition
> on a given boot media, one that is more than sufficient
> in size for all but the biggest RAM system --but to then
> be able to tell the system to just use up to the
> recommended swap space size and to ignore any extra swap
> space in the swap partition.

Last I looked at that code, that is precisely what happens
if you add a too big swap-device ?

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



An idea for swap partition size vs. swap space size in use handling

2023-01-21 Thread Mark Millard
I have boot media that are each set up to boot a variety
of systems that have widely different RAM sizes, from
1 GiBytes to 64 GiBytes for the aarch64 examples of this.

This has lead to having multiple swap partitions of
various sizes so that I can have total swap spaces that
are somewhat under the recommended maximum sizes for the
amount of RAM in each of those systems that a given media
can boot.

It would be nice if I could have just one swap partition
on a given boot media, one that is more than sufficient
in size for all but the biggest RAM system --but to then
be able to tell the system to just use up to the
recommended swap space size and to ignore any extra swap
space in the swap partition.

If such could be done, I'd no longer use multiple swap
partitions at the same time in order to get to a desired
total for the system at hand at the time.

Of course, that still leaves what to do when multiple
swap partitions are enabled if such a "ignore what
would be extra" mode was also enabled. As I'd not use
such, I've no specific recommendations to make that
would make any difference to my use.

===
Mark Millard
marklmi at yahoo.com




Re: netlink socket does not accept SOCK_DGRAM

2023-01-21 Thread Alexander V. Chernikov


> On 16 Jan 2023, at 15:13, Alexander V. Chernikov  wrote:
> 
> 
> 
>> On 15 Jan 2023, at 13:09, Alexander V. Chernikov  wrote:
>> 
>>> 
>>> On 15 Jan 2023, at 02:26, User Ngor  wrote:
>>> 
>>> man 4 rtnetlink says:
>>> 
>>>   int socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
>>> 
>>> 
>>> 
>>> The following snippet fails
>>> 
>>>  int fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
>>>  if (fd < 0) {
>>>  perror("Failed to open netlink socket");
>>>  return -1;
>>>  }
>>>  printf("all good\n");
>>>  close(fd);
>>>  return 0;
>>> 
>>> I get: Failed to open netlink socket: Protocol wrong type for socket
>>> 
>>> 
>>> but if I change
>>> int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
>>> 
>>> I get "all good"
>>> 
>>> Am I doing something wrong or is this a bug?
>> It’s a bug. The manage should state SOCK_RAW, but both options should be 
>> supported, which is not the case ATM.
>> I’ll fix it in a couple of days.
> Raised https://reviews.freebsd.org/D38075 with a fix.
Committed as 0079d177ab69.
>> Meanwhile it may be worth looking into snl(3) which abstracts issues like 
>> this one.
>>> 
>>> 
>>> 
>>> $ uname -a FreeBSD zen.hq 14.0-CURRENT FreeBSD 14.0-CURRENT #0 
>>> main-n259967-11b5b9e8a520: Sat Jan  7 16:39:30 UTC 2023 
>>> r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
>>> 
>>> $ kldstat | grep netl
>>> 391 0x839fc00014af8 netlink.ko
>>> 
>>> 
>>> -- 
>>> Ihor Antonov