Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485524

Re: [REGRESSION] RLIMIT_DATA crashes named

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Konstantin Khlebnikov <koct9i@gmail.com>
Newsgroups linux.kernel
Subject Re: [REGRESSION] RLIMIT_DATA crashes named
Date Sat, 17 Sep 2016 14:10:01 +0200
Message-ID <simBr-2mp-3@gated-at.bofh.it> (permalink)
References <si35L-6q0-15@gated-at.bofh.it> <si5qW-7Rv-25@gated-at.bofh.it> <si7M6-1bq-29@gated-at.bofh.it> <si85r-1i1-3@gated-at.bofh.it> <si9Xz-2wp-1@gated-at.bofh.it> <sibcZ-3e3-1@gated-at.bofh.it> <sibmF-3x5-1@gated-at.bofh.it> <sif6W-61z-9@gated-at.bofh.it> <sijkd-ei-1@gated-at.bofh.it> <sijWW-GT-11@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rLS3kBTzYoeW0dR0rp8Cv2ItlG2a+gf9+ltqV8kGhKk=; b=eA0xeVd/plqMauPvryB1B8jfXfG32uCqsxJc7LOHh7YzrYILbLZl3LWbkfmXKOpN0e WpDr40HG07NOKvgR0X4az1VvvMWLnydTBjHCpxvGLYyr0aUqLj71Vr6+q/Qk7SPYOyZe IDcvNqQoAyoCuz/1iHhVIltzVcDrE0xTEe8+XBWwfTLj9qtZKu79MTe+RS5ppVseqQ7N x4IcAPxp9qAvCJv/1sb/6gJYmEZTn3lORy18op6i/hHv2EwEXJCyszGn63qM3w+qhXvj XDHmX1OLnzBMwOBxpSgzERgxc9kX2XyAqeyHhfSscp9VXS9tw2VaLNm5sOd1NHxn5/a8 hC6Q==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rLS3kBTzYoeW0dR0rp8Cv2ItlG2a+gf9+ltqV8kGhKk=; b=THJ19+CHA6Cjh++i79uvd2HX6OPY5WnSQnHJvtyA+oh74xO36o6sgcwZt6ClzpjxXd 4VZ0I3jKF4wT3ERX6HUhk5vFMsJIBou0e8P9n8wiTsm7YZmshW53+CbReDZxneItSnNQ a8vGUj2M+UV3oZPcB5fPem8Ruin8GHY73bs312SunyyIDf758/jYpzGOiyKR8nxTd/nA b4OgG1wJcSV9D8KiljkIo08qfQU/OLArxXxOaiJxKP0qu/OptDQeZPRC6Z/dcI2jK1rR aUlc/IG9KhVra+/6CmTIv+eKKy0EePQ42/nsunFXo0/ywKO8dHAZW2BMKz18EZXJkS8A NDcw==
X-Gm-Message-State AE9vXwO5uTvVoywp+UcAQFKWQLXvU5dwMXmR8QG9Ex/fnyimr/W/KrshUkncoq/FVibyR1l1ZjOmUU6676YLnw==
X-Received by 10.25.158.140 with SMTP id h134mr7428572lfe.0.1474114150086; Sat, 17 Sep 2016 05:09:10 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc Joe Perches <joe@perches.com>, Linus Torvalds <torvalds@linux-foundation.org>, Sam Varshavchik <mrsam@courier-mta.com>, Ingo Molnar <mingo@kernel.org>, Laura Abbott <labbott@redhat.com>, Brent <fix@bitrealm.com>, Andrew Morton <akpm@linux-foundation.org>, Christian Borntraeger <borntraeger@de.ibm.com>, "linux-mm@kvack.org" <linux-mm@kvack.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
X-Original-Date Sat, 17 Sep 2016 15:09:09 +0300
X-Original-Message-ID <CALYGNiNzdsnzCZXg_-2u1Tv8+RdRFJVXa6iXY+s64=+LHr2TSA@mail.gmail.com>
X-Original-References <33304dd8-8754-689d-11f3-751833b4a288@redhat.com> <CA+55aFyfny-0F=VKKe6BCm-=fX5b08o1jPjrxTBOatiTzGdBVg@mail.gmail.com> <d4e15f7b-fedd-e8ff-539f-61d441b402cd@redhat.com> <CA+55aFzWts-dgNRuqfwHu4VeN-YcRqkZdMiRpRQ=Pg91sWJ=VQ@mail.gmail.com> <cone.1474065027.299244.29242.1004@monster.email-scan.com> <CA+55aFwPNBQePQCQ7qRmvn-nVaEn2YVsXnBFc5y1UVWExifBHw@mail.gmail.com> <CA+55aFy-mMfj3qj6=WMawEUGEkwnFEqB_=S6Pxx3P_c58uHW2w@mail.gmail.com> <1474085296.32273.95.camel@perches.com> <CALYGNiNuF1Ggy=DyYG32HXbnJp3Q0cX9ekQ5w2jR1M9rkKaX9A@mail.gmail.com> <20160917090941.GB26044@uranus.lan>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1485524

Show key headers only | View raw


On Sat, Sep 17, 2016 at 12:09 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> On Sat, Sep 17, 2016 at 11:33:56AM +0300, Konstantin Khlebnikov wrote:
>> >
>> > do_just_once just isn't a good name for a global
>> > rate limited mechanism that does something very
>> > different than the name.
>> >
>> > Maybe allow_once_per_ratelimit or the like
>> >
>> > There could be an equivalent do_once
>> >
>> > https://lkml.org/lkml/2009/5/22/3
>> >
>>
>> What about this printk_reriodic() and pr_warn_once_per_minute()?
>>
>> It simply remembers next jiffies to print rather than using that
>> complicated ratelimiting engine.
>
> +#define printk_periodic(period, fmt, ...)                      \
> +({                                                             \
> +       static unsigned long __print_next __read_mostly = INITIAL_JIFFIES; \
> +       bool __do_print = time_after_eq(jiffies, __print_next); \
> +                                                               \
> +       if (__do_print) {                                       \
> +               __print_next = jiffies + (period);              \
> +               printk(fmt, ##__VA_ARGS__);                     \
> +       }                                                       \
> +       unlikely(__do_print);                                   \
> +})
>
> Seems I don't understand the bottom unlikely...

This is gcc extrension:  https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
Here macro works as a function which returns bool

After second though macro should update __print_next if it's too far
if first warning happens too late here will long period of silence
untill next jiffies overlap.

something like

#define printk_periodic(period, fmt, ...)
({
static unsigned long __print_next = INITIAL_JIFFIES;
unsigned long __print_jiffies = jiffies;
bool __do_print = time_after_eq(__print_jiffies, __print_next);

if (__do_print) {
        __print_next = __print_jiffies + (period);
        printk(fmt, ##__VA_ARGS__);
} else if (time_after(__print_next, __print_jiffies + (period))
        __print_next = __print_jiffies + (period);
unlikely(__do_print);
})

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[REGRESSION] RLIMIT_DATA crashes named Laura Abbott <labbott@redhat.com> - 2016-09-16 17:20 +0200
  Re: [REGRESSION] RLIMIT_DATA crashes named Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-16 19:50 +0200
    Re: [REGRESSION] RLIMIT_DATA crashes named Laura Abbott <labbott@redhat.com> - 2016-09-16 22:20 +0200
      Re: [REGRESSION] RLIMIT_DATA crashes named Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-16 22:40 +0200
        Re: [REGRESSION] RLIMIT_DATA crashes named Sam Varshavchik <mrsam@courier-mta.com> - 2016-09-17 00:40 +0200
          Re: [REGRESSION] RLIMIT_DATA crashes named Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-17 02:00 +0200
            Re: [REGRESSION] RLIMIT_DATA crashes named Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-17 02:10 +0200
              Re: [REGRESSION] RLIMIT_DATA crashes named Joe Perches <joe@perches.com> - 2016-09-17 06:10 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Konstantin Khlebnikov <koct9i@gmail.com> - 2016-09-17 10:40 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-17 11:20 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Konstantin Khlebnikov <koct9i@gmail.com> - 2016-09-17 14:10 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-17 14:30 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Konstantin Khlebnikov <koct9i@gmail.com> - 2016-09-17 23:50 +0200
                Re: [REGRESSION] RLIMIT_DATA crashes named Joe Perches <joe@perches.com> - 2016-09-18 00:00 +0200

csiph-web