Patch "s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-cpum_sf-adjust-sampling-interval-to-avoid-hitti.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6b19c4e259e8995d85ba2bcf8e422e2468863992
Author: Thomas Richter <tmricht@xxxxxxxxxxxxx>
Date:   Thu Nov 28 10:26:41 2019 +0100

    s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
    
    [ Upstream commit 39d4a501a9ef55c57b51e3ef07fc2aeed7f30b3b ]
    
    Function perf_event_ever_overflow() and perf_event_account_interrupt()
    are called every time samples are processed by the interrupt handler.
    However function perf_event_account_interrupt() has checks to avoid being
    flooded with interrupts (more then 1000 samples are received per
    task_tick).  Samples are then dropped and a PERF_RECORD_THROTTLED is
    added to the perf data. The perf subsystem limit calculation is:
    
        maximum sample frequency := 100000 --> 1 samples per 10 us
        task_tick = 10ms = 10000us --> 1000 samples per task_tick
    
    The work flow is
    
    measurement_alert() uses SDBT head and each SBDT points to 511
     SDB pages, each with 126 sample entries. After processing 8 SBDs
     and for each valid sample calling:
    
         perf_event_overflow()
           perf_event_account_interrupts()
    
    there is a considerable amount of samples being dropped, especially when
    the sample frequency is very high and near the 100000 limit.
    
    To avoid the high amount of samples being dropped near the end of a
    task_tick time frame, increment the sampling interval in case of
    dropped events. The CPU Measurement sampling facility on the s390
    supports only intervals, specifiing how many CPU cycles have to be
    executed before a sample is generated. Increase the interval when the
    samples being generated hit the task_tick limit.
    
    Signed-off-by: Thomas Richter <tmricht@xxxxxxxxxxxxx>
    Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 3d8b12a9a6ff..8c384e6ea36a 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -1312,6 +1312,22 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
 	if (sampl_overflow)
 		OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) +
 						 sampl_overflow, 1 + num_sdb);
+
+	/* Perf_event_overflow() and perf_event_account_interrupt() limit
+	 * the interrupt rate to an upper limit. Roughly 1000 samples per
+	 * task tick.
+	 * Hitting this limit results in a large number
+	 * of throttled REF_REPORT_THROTTLE entries and the samples
+	 * are dropped.
+	 * Slightly increase the interval to avoid hitting this limit.
+	 */
+	if (event_overflow) {
+		SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10);
+		debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n",
+				    __func__,
+				    DIV_ROUND_UP(SAMPL_RATE(hwc), 10));
+	}
+
 	if (sampl_overflow || event_overflow)
 		debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: "
 				    "overflow stats: sample=%llu event=%llu\n",



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux