Look, noone can tell you if your 22 GB inno_db_buffer_size is a good value for your server. If your RAM is excessively overused by MariaDB, then your RAM is just too small for the configuration or your configuration is inappropriate for the RAM that your server has. If your RAM is 64 GB and a 22 GB cache of MariaDB leads to swapping, it's not actually MariaDB, but other processes on the server that consume too much RAM. It cannot be that hard to look into the process list which processes are consuming the most RAM and breaking that down to the root cause.
Many sources on MariaDB in forums say that admitting up to 70% of available RAM to the InnoDB buffer is fine, but if there are other processes on your machine that require more RAM, that RAM will not be available for MariaDB. Who knows. It just needs to be carefully checked on the server what the server is using for which process(es), and then, in a further step, it needs to be determined if you can either reduce the overuse by other processes or if you need more RAM to avoid swapping.