Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-29 Thread Lasse Collin
On 2024-02-28 Sebastian Andrzej Siewior wrote:
> On 2024-02-28 18:45:03 [+0200], Lasse Collin wrote:
> > V_DEBUG was commited to the master and v5.6 branches a few moments
> > ago, so yes, your plan sounds good. :-) Feel free to do it as you
> > prefer, either just making the change or picking the other simple
> > fixes from v5.6 as well.  
> 
> Perfect. I just took the patch.

Thanks! :-)

> > Hopefully the already-added workarounds in other packages don't
> > cause any unwanted side effects in the future.  
> 
> The plan was to revert it. All good.

:-)

There is a branch "memavail" on GitHub with experimental support for
MemAvailable from Linux /proc/meminfo. It needs discussion and
feedback (likely in a new thread). There is no rush as it's not for
5.6.x anyway.

-- 
Lasse Collin



Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-28 Thread Lasse Collin
On 2024-02-28 Sebastian Andrzej Siewior wrote:
> I see. In that case let me throw this to V_DEBUG Debian wise and sync
> with xz upstream once a new release is up or so. I have two packages
> that fail because of this and dpkg added a workaround. So instead
> adding another workaround to another package I would fix this on the
> xz side. Sounds good?

V_DEBUG was commited to the master and v5.6 branches a few moments ago,
so yes, your plan sounds good. :-) Feel free to do it as you prefer,
either just making the change or picking the other simple fixes from
v5.6 as well.

Hopefully the already-added workarounds in other packages don't cause
any unwanted side effects in the future.

Thanks!

-- 
Lasse Collin



Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-28 Thread Sebastian Andrzej Siewior
On 2024-02-28 13:00:08 [+0200], Lasse Collin wrote:
> > > There are also messages that are shown when memory limit does affect
> > > compressed output (switching to single-threaded mode and LZMA2
> > > dictionary size adjustment). The verbosity requirement of these
> > > messages isn't being changed now.  
> > 
> > This sounds like you accept this change in principle but are thinking
> > if V_VERBOSE or V_DEBUG is the right thing.
> 
> Me and three other people on IRC think it should be changed but there
> is no consensus yet what exactly is the best (your patch, -v, or -vv).
> This is about the thread count messages only as (since 5.4.0) automatic
> thread count doesn't affect the compressed output.
> 
> There is some discussion also here:
> 
> https://github.com/tukaani-project/xz/issues/89

I see. In that case let me throw this to V_DEBUG Debian wise and sync
with xz upstream once a new release is up or so. I have two packages
that fail because of this and dpkg added a workaround. So instead adding
another workaround to another package I would fix this on the xz side.
Sounds good?

Sebastian



Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-28 Thread Lasse Collin
On 2024-02-27 Sebastian Andrzej Siewior wrote:
> On 2024-02-27 19:17:48 [+0200], Lasse Collin wrote:
> >   - The silencing could be done with -q as well though.  
> 
> Wouldn't -q also shut some legitime warnings?

Yes. When compressing from stdin to stdout, there aren't many possible
warnings but there are still a few rare ones. So -q isn't ideal to get
rid of thread count reduction messages.

> Isn't the automatic memory usage accurate?

It's simply 25 % of total RAM. The Linux-specific MemAvailable from
/proc/meminfo didn't get into 5.6.0. Perhaps it could be done in the
next development cycle, and maybe also look for similar features on a
few other OSes.

> Not sure if documenting it in the man-page would help here.

One issue is that currently the message tells about thread count
reduction and what the memlimit is but not how much memory is actually
required. One needs to use -vv to get the usage info.

Documenting on the man page could be good if it can be explained in an
understandable way and people can find it there. The man page is long
already.

The less average users *need* to understand the details the better.

> > There are also messages that are shown when memory limit does affect
> > compressed output (switching to single-threaded mode and LZMA2
> > dictionary size adjustment). The verbosity requirement of these
> > messages isn't being changed now.  
> 
> This sounds like you accept this change in principle but are thinking
> if V_VERBOSE or V_DEBUG is the right thing.

Me and three other people on IRC think it should be changed but there
is no consensus yet what exactly is the best (your patch, -v, or -vv).
This is about the thread count messages only as (since 5.4.0) automatic
thread count doesn't affect the compressed output.

There is some discussion also here:

https://github.com/tukaani-project/xz/issues/89

-- 
Lasse Collin



Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-27 Thread Sebastian Andrzej Siewior
On 2024-02-27 19:17:48 [+0200], Lasse Collin wrote:
> Thanks for the patch! We discussed a bit on IRC and everyone thinks
> it's on the right track but we are pondering the implementation details
> still.
> 
> The thread count messages are shown in situations which don't affect
> the compressed output, and thus the importance of these messages isn't
> so high. Originally they were there to reduce the chance of people
> asking why xz isn't using as many threads as requested.

Understood.

> We are considering to simply change those two message() calls to always
> use V_VERBOSE or V_DEBUG instead of the current V_WARNING. So automatic
> vs. manual number of threads wouldn't affect it like it does in your
> patch. Comparing your apporach and this simpler one:
> 
>   + There are scripts that take a user-specified number for
> parallelization and that number is passed to multiple tools, not
> just xz. Keeping xz -T16 silent about thread count reduction can
> make sense in this case.
> 
>   - The silencing could be done with -q as well though.

Wouldn't -q also shut some legitime warnings?

> There are pros and cons between V_VERBOSE and V_DEBUG.
> 
> For (de)compression, a single -v sets V_VERBOSE and actives the
> progress indicator. If the thread count messages are shown at -v, on
> some systems progress indicator usage would get the message about
> reduced thread count as well.
> 
>   + It works as a hint that increasing the memory usage limits manually
> might allow more threads to be used.
> 
>   - If one uses progress indicator frequently, the thread count
> reduction message might become slightly annoying as the information
> is already known by the user.
> 
>   - Progress indicator can be used in non-interactive cases (when
> stderr isn't a terminal). Then xz only prints a final summary per
> file. This likely is not a common use case but the thread count
> messages would be here as well.
> 
> V_DEBUG is set when -v is used twice (-vv).
> 
>   + Regular progress indicator uses wouldn't get extra messages.
> 
>   - A larger number of users might not become aware that they aren't
> getting as many threads as they could because the automatic memory
> usage limit is too low to allow more threads.

Isn't the automatic memory usage accurate? Because then there is hardly
something you could do about it. Maybe kill chrome…
On the other hand if they decompress and they have 32s CPU and xz
reduces it to 16 threads then there is no "loss" if the file has 16
blocks or less :)
Not sure if documenting it in the man-page would help here.

> There are also messages that are shown when memory limit does affect
> compressed output (switching to single-threaded mode and LZMA2
> dictionary size adjustment). The verbosity requirement of these messages
> isn't being changed now.

This sounds like you accept this change in principle but are thinking if
V_VERBOSE or V_DEBUG is the right thing.

Sebastian



Re: [xz-devel] [PATCH] xz: Avoid warnings due to memlimit if threads are in auto mode.

2024-02-27 Thread Lasse Collin
On 2024-02-26 Sebastian Andrzej Siewior wrote:
> Print the warning about reduced threads only if number is selected
> - automatically and asked to be verbose (-v)
> - explicit by the user

Thanks for the patch! We discussed a bit on IRC and everyone thinks
it's on the right track but we are pondering the implementation details
still.

The thread count messages are shown in situations which don't affect
the compressed output, and thus the importance of these messages isn't
so high. Originally they were there to reduce the chance of people
asking why xz isn't using as many threads as requested.

We are considering to simply change those two message() calls to always
use V_VERBOSE or V_DEBUG instead of the current V_WARNING. So automatic
vs. manual number of threads wouldn't affect it like it does in your
patch. Comparing your apporach and this simpler one:

  + There are scripts that take a user-specified number for
parallelization and that number is passed to multiple tools, not
just xz. Keeping xz -T16 silent about thread count reduction can
make sense in this case.

  - The silencing could be done with -q as well though.

There are pros and cons between V_VERBOSE and V_DEBUG.

For (de)compression, a single -v sets V_VERBOSE and actives the
progress indicator. If the thread count messages are shown at -v, on
some systems progress indicator usage would get the message about
reduced thread count as well.

  + It works as a hint that increasing the memory usage limits manually
might allow more threads to be used.

  - If one uses progress indicator frequently, the thread count
reduction message might become slightly annoying as the information
is already known by the user.

  - Progress indicator can be used in non-interactive cases (when
stderr isn't a terminal). Then xz only prints a final summary per
file. This likely is not a common use case but the thread count
messages would be here as well.

V_DEBUG is set when -v is used twice (-vv).

  + Regular progress indicator uses wouldn't get extra messages.

  - A larger number of users might not become aware that they aren't
getting as many threads as they could because the automatic memory
usage limit is too low to allow more threads.

There are also messages that are shown when memory limit does affect
compressed output (switching to single-threaded mode and LZMA2
dictionary size adjustment). The verbosity requirement of these messages
isn't being changed now.

-- 
Lasse Collin