Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 118E7B5DBF7 for ; Sun, 18 Sep 2011 13:21:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 16071-05 for ; Sun, 18 Sep 2011 16:21:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id B0705B5DBF2 for ; Sun, 18 Sep 2011 13:21:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p8IGL810015954; Sun, 18 Sep 2011 12:21:08 -0400 (EDT) To: Peter Eisentraut cc: pgsql-hackers@postgreSQL.org Subject: Re: /proc/self/oom_adj is deprecated in newer Linux kernels In-reply-to: <1316355543.12186.9.camel@vanquo.pezone.net> References: <29121.1316185073@sss.pgh.pa.us> <1316355543.12186.9.camel@vanquo.pezone.net> Comments: In-reply-to Peter Eisentraut message dated "Sun, 18 Sep 2011 17:19:02 +0300" Date: Sun, 18 Sep 2011 12:21:08 -0400 Message-ID: <15953.1316362868@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/831 X-Sequence-Number: 195020 Peter Eisentraut writes: > On fre, 2011-09-16 at 10:57 -0400, Tom Lane wrote: >> So it looks like it behooves us to cater for oom_score_adj in the >> future. The simplest, least risky change that I can think of is to >> copy-and-paste the relevant #ifdef code block in fork_process.c. >> If we do that, then it would be up to the packager whether to #define >> LINUX_OOM_ADJ or LINUX_OOM_SCORE_ADJ or both depending on the behavior >> he wants. > There are lots of reasons why that won't work: backports, forward ports, > derivatives, custom kernels, distribution upgrades, virtual hosting. [ shrug... ] These are all hypothetical reasons. A packager who foresaw needing that could just turn on both write attempts, or for that matter patch the code to do whatever else he saw fit. In practice, we've not had requests for anything significantly smarter than what is there. But having said that, it wouldn't be very hard to arrange things so that if you did have both symbols defined, the code would only attempt to write oom_adj if it had failed to write oom_score_adj; which is about as close as you're likely to get to a kernel version test for this. regards, tom lane